Skip to content

Commit ddd44bd

Browse files
committed
Add LUA_LOADED_TABLE constant (Luau)
1 parent 1152519 commit ddd44bd

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

mlua-sys/src/luau/compat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ pub unsafe fn luaL_getsubtable(L: *mut lua_State, idx: c_int, fname: *const c_ch
544544

545545
pub unsafe fn luaL_requiref(L: *mut lua_State, modname: *const c_char, openf: lua_CFunction, glb: c_int) {
546546
luaL_checkstack(L, 3, cstr!("not enough stack slots available"));
547-
luaL_getsubtable(L, LUA_REGISTRYINDEX, cstr!("_LOADED"));
547+
luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE);
548548
if lua_getfield(L, -1, modname) == LUA_TNIL {
549549
lua_pop(L, 1);
550550
lua_pushcfunction(L, openf);

mlua-sys/src/luau/lauxlib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ use std::ptr;
55

66
use super::lua::{self, lua_CFunction, lua_Number, lua_State, lua_Unsigned, LUA_REGISTRYINDEX};
77

8+
// Key, in the registry, for table of loaded modules
9+
pub const LUA_LOADED_TABLE: *const c_char = cstr!("_LOADED");
10+
811
#[repr(C)]
912
pub struct luaL_Reg {
1013
pub name: *const c_char,

0 commit comments

Comments
 (0)