Skip to content

Commit 37547fb

Browse files
committed
Fixed minor Lua stack issue
1 parent 44bfbf1 commit 37547fb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

scripting/lua_scripting.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,22 +226,22 @@ void CScriptEngine::OpenLuaDelayed ()
226226

227227

228228
// add luacom to package.preload
229-
lua_getglobal (L, LUA_LOADLIBNAME); /* "package" */
229+
lua_getglobal (L, LUA_LOADLIBNAME); // package table
230230

231-
if (lua_istable (L, -1))
231+
if (lua_istable (L, -1)) // if it exists and is a table
232232
{
233-
lua_getfield (L, -1, "preload");
233+
lua_getfield (L, -1, "preload"); // get preload table inside it
234234

235-
if (lua_istable (L, -1))
235+
if (lua_istable (L, -1)) // preload table exists
236236
{
237-
lua_pushcfunction(L, luacom_open_glue);
238-
lua_setfield(L, -2, "luacom");
239-
lua_pop (L, 1); // get rid of preload table from stack
237+
lua_pushcfunction(L, luacom_open_glue); // luacom open
238+
lua_setfield(L, -2, "luacom");
240239
} // have package.preload table
241240

242-
lua_pop (L, 1); // get rid of package table from stack
241+
lua_pop (L, 1); // get rid of preload table from stack
243242
} // have package table
244243

244+
lua_pop (L, 1); // get rid of package table from stack
245245

246246
lua_settop(L, 0); // clear stack
247247

0 commit comments

Comments
 (0)