diff options
author | Philipp Janda <siffiejoe@gmx.net> | 2015-02-25 18:18:25 +0100 |
---|---|---|
committer | Philipp Janda <siffiejoe@gmx.net> | 2015-02-25 18:18:25 +0100 |
commit | af77e00ac0d1a0ddbc9218e9b0ab12381396e253 (patch) | |
tree | a0b681cde331b32ab786cee72cc23aa239cf746e | |
parent | b459455e78e6c24d257982e3961142182bfe0e06 (diff) | |
parent | 414962d38fcc49da057fb05fb5de85abb41a5994 (diff) | |
download | lua-compat-5.3-af77e00ac0d1a0ddbc9218e9b0ab12381396e253.tar.gz lua-compat-5.3-af77e00ac0d1a0ddbc9218e9b0ab12381396e253.tar.bz2 lua-compat-5.3-af77e00ac0d1a0ddbc9218e9b0ab12381396e253.zip |
Merge pull request #9 from ghedo/requiref
make sure that _LOADED is not nil
-rw-r--r-- | c-api/compat-5.3.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/c-api/compat-5.3.c b/c-api/compat-5.3.c index 2fdd36d..962b951 100644 --- a/c-api/compat-5.3.c +++ b/c-api/compat-5.3.c | |||
@@ -510,7 +510,7 @@ COMPAT53_API size_t lua_stringtonumber (lua_State *L, const char *s) { | |||
510 | COMPAT53_API void luaL_requiref (lua_State *L, const char *modname, | 510 | COMPAT53_API void luaL_requiref (lua_State *L, const char *modname, |
511 | lua_CFunction openf, int glb) { | 511 | lua_CFunction openf, int glb) { |
512 | luaL_checkstack(L, 3, "not enough stack slots available"); | 512 | luaL_checkstack(L, 3, "not enough stack slots available"); |
513 | lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); | 513 | luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED"); |
514 | if (lua_getfield(L, -1, modname) == LUA_TNIL) { | 514 | if (lua_getfield(L, -1, modname) == LUA_TNIL) { |
515 | lua_pop(L, 1); | 515 | lua_pop(L, 1); |
516 | lua_pushcfunction(L, openf); | 516 | lua_pushcfunction(L, openf); |