aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Ghedini <alessandro@ghedini.me>2015-02-25 16:51:26 +0100
committerAlessandro Ghedini <alessandro@ghedini.me>2015-02-25 16:51:26 +0100
commit414962d38fcc49da057fb05fb5de85abb41a5994 (patch)
treea0b681cde331b32ab786cee72cc23aa239cf746e
parentb459455e78e6c24d257982e3961142182bfe0e06 (diff)
downloadlua-compat-5.3-414962d38fcc49da057fb05fb5de85abb41a5994.tar.gz
lua-compat-5.3-414962d38fcc49da057fb05fb5de85abb41a5994.tar.bz2
lua-compat-5.3-414962d38fcc49da057fb05fb5de85abb41a5994.zip
make sure that _LOADED is not nil
-rw-r--r--c-api/compat-5.3.c2
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) {
510COMPAT53_API void luaL_requiref (lua_State *L, const char *modname, 510COMPAT53_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);