-
Hi! Sawcce |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 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). |
Beta Was this translation helpful? Give feedback.
-
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? |
Beta Was this translation helpful? Give feedback.
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
.