Bytecode

Bytecode is a set of machine-readable instructions: it's what the computer executes, after code written in a programming language is compiled.

In ROBLOX Lua's case, users used to be able to load raw Lua bytecode using the loadstring function, and it was often used for one of two purposes:


 * Obfuscating the code, to avoid modification of a script– aiding particularly to avoid model copying
 * Malicious scripts which would use flaws in the verification algorithm to perform things they shouldn't be able to normally

Bytecode was removed from ROBLOX August 3, 2012, due to the various security issues it implicated and because it shouldn't have been allowed in the first place. It is known that popular places, such as Wingman8's Galleons, were left broken due to them using bytecode as an obfuscation method. Galleons were fixed in January 2020.

Usage
As an example of bytecode and loading of it, consider the following "hello world" script:

print("Hello World!")

Which would yield the following bytecode, represented as an hex dump for readability:

00000000 1B 4C 75 61 51 00 01 04 04 04 08 00 12 00 00 00 .LuaQ........... 00000010 3D 57 6F 72 6B 73 70 61 63 65 2E 53 63 72 69 70 =Workspace.Scrip 00000020 74 00 01 00 00 00 03 00 00 00 00 00 00 02 04 00 t............... 00000030 00 00 05 00 00 00 41 40 00 00 1C 40 00 01 1E 00 ......A@...@.... 00000040 80 00 02 00 00 00 04 06 00 00 00 70 72 69 6E 74 €..........print 00000050 00 04 0C 00 00 00 48 65 6C 6C 6F 20 57 6F 72 6C ......Hello Worl 00000060 64 00 00 00 00 00 04 00 00 00 02 00 00 00 02 00 d............... 00000070 00 00 02 00 00 00 03 00 00 00 00 00 00 00 00 00 ................ 00000080 00 00 ..

This bytecode, before the removal of bytecode mentioned above, could be loaded in a standard RBX.Lua script this way:

loadstring('\27\76\117\97\81\0\1\4\8\4\8\0\47\0\0\0\0\0\0\0\114\101\116 \117\114\110\32\102\117\110\99\116\105\111\110\40\41\32\10\112\114\105\110 \116\40\34\72\101\108\108\111\32\87\111\114\108\100\33\34\41\10\10\32 \101\110\100\0\1\0\0\0\4\0\0\0\0\0\0\2\4\0\0\0\5\0\0\0\65\64\0\0\28\64\0 \1\30\0\128\0\2\0\0\0\4\6\0\0\0\0\0\0\0\112\114\105\110\116\0\4\13\0 \0\0\0\0\0\0\72\101\108\108\111\32\87\111\114\108\100\33\0\0\0\0\0\4\0\0\0 \2\0\0\0\2\0\0\0\2\0\0\0\4\0\0\0\0\0\0\0\0\0\0\0')