diff options
author | Alex Orlenko <zxteam@protonmail.com> | 2023-05-24 19:04:38 +0100 |
---|---|---|
committer | Alex Orlenko <zxteam@protonmail.com> | 2023-05-24 23:13:12 +0100 |
commit | 22e748557c4589a33b7930a7d99fe2ff8cdf8109 (patch) | |
tree | b20622666fb1fa668df6a2e6c1b3dae6f15ace78 /src/util.rs | |
parent | 77effb50552b782fa936cf2d08268c581a136f0d (diff) | |
download | mlua-22e748557c4589a33b7930a7d99fe2ff8cdf8109.zip |
Add new feature flag `luau-jit` to enable experimental Luau codegen backend
Diffstat (limited to 'src/util.rs')
-rw-r--r-- | src/util.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util.rs b/src/util.rs index cd0f32e..690a9e1 100644 --- a/src/util.rs +++ b/src/util.rs @@ -460,6 +460,11 @@ unsafe fn init_userdata_metatable_index(state: *mut ffi::lua_State) -> Result<() ffi::lua_pushcfunction(state, lua_isfunction_impl); ffi::lua_call(state, 2, 1); + #[cfg(feature = "luau-jit")] + if ffi::luau_codegen_supported() != 0 { + ffi::luau_codegen_compile(state, -1); + } + // Store in the registry ffi::lua_pushvalue(state, -1); ffi::lua_rawsetp(state, ffi::LUA_REGISTRYINDEX, index_key); @@ -508,6 +513,11 @@ pub unsafe fn init_userdata_metatable_newindex(state: *mut ffi::lua_State) -> Re ffi::lua_pushcfunction(state, lua_isfunction_impl); ffi::lua_call(state, 2, 1); + #[cfg(feature = "luau-jit")] + if ffi::luau_codegen_supported() != 0 { + ffi::luau_codegen_compile(state, -1); + } + // Store in the registry ffi::lua_pushvalue(state, -1); ffi::lua_rawsetp(state, ffi::LUA_REGISTRYINDEX, newindex_key); |