Skip to content

Commit 839732e

Browse files
committed
Fix some problems with Lua function refs
1 parent e1582d0 commit 839732e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/lstate.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ LUA_API void lua_close (lua_State *L) {
214214

215215
// MTA specific
216216
LUA_API lua_State* lua_getmainstate (lua_State *L) {
217-
return G(L)->mainthread;
217+
if ( L )
218+
{
219+
lua_State* Result = G(L)->mainthread;
220+
if ( Result )
221+
L = Result;
222+
}
223+
return L;
218224
}
219225

0 commit comments

Comments
 (0)