Repository navigation
|
Hi! Sawcce |
Answered by
khvzak
Mar 23, 2022
Replies: 3 comments 4 replies
0 replies
|
You can load chunk and then dump it to bytecode: let bytecode = lua.load("return 1 + 1").into_function()?.dump(true);
// To load it back
let result = lua.load(&bytecode).set_mode(ChunkMode::Binary).eval::<i32>()?;
assert_eq!(result, 2);Starting from 0.8.0 bytecode can be loaded without restrictions (since too many ways available to load bytecode and too much effort to protect all that places). |
1 reply
Answer selected by
sawcce
|
While I'm at it since it seems like the dump function is only usable with the LuaJIT feature I can't use luau with it right? |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can load chunk and then dump it to bytecode:
Starting from 0.8.0 bytecode can be loaded without restrictions (since too many ways available to load bytecode and too much effort to protect all that places).
On the previous versions Lua must be created via
unsafe_new.