I have been fiddling with luac recently, and I decided to try and execute a binary file created by it using dofile, however it likes to just throw a Java Heap Space error. Am I misinformed, or this is impossible to do within CC?
LUAC binary files and CC
Started by クデル, Jul 08 2016 09:43 AM
1 reply to this topic
#1
Posted 08 July 2016 - 09:43 AM
#2
Posted 08 July 2016 - 10:20 AM
It's not impossible, you can use string.dump to dump a function and loadstring the dump back into a function. On never versions of CC though, you only have load (which you would call with the dump and a string "b" as the third parameter) and you get a Lua-level error, something like "binary chunk loading is prohibited", but you can get around that with a modified bios.lua.
If you "compile" a Lua source with luac, it'll dump bytecode compatible with the Lua library it was built with. The last time I checked, the bytecode of the official implementation of the Lua library is incompatible with LuaJ's bytecode, so that might be why you get Java-level errors. I get a NullPointerException when I try to loadstring("\27Lua"), so it's not too well protected, you can easily get it to throw a Java-level error with invalid bytecode.
If you "compile" a Lua source with luac, it'll dump bytecode compatible with the Lua library it was built with. The last time I checked, the bytecode of the official implementation of the Lua library is incompatible with LuaJ's bytecode, so that might be why you get Java-level errors. I get a NullPointerException when I try to loadstring("\27Lua"), so it's not too well protected, you can easily get it to throw a Java-level error with invalid bytecode.
Edited by LBPHacker, 08 July 2016 - 10:21 AM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











