Robin Wellner avatar Robin Wellner committed 2550fa4

Finally fixed frustratring failing, all thanks to bartbes

Comments (0)

Files changed (1)

src/modules/thread/sdl/Thread.cpp

 			lua_pushlstring(L, name, len);
 		}
 
+		
+		luax_convobj(L, lua_gettop(L), "thread", "getThread");
+		lua_getglobal(L, "love");
+
 		// Sandbox
 		if (luaL_loadbuffer(L, (const char *)love::sandbox_lua, sizeof(love::sandbox_lua), "sandbox.lua") == 0)
 		{
 			lua_call(L, 0, 0);
-			lua_getglobal(L, "love");
-			lua_pushstring(L, "_sandbox");
-			lua_gettable(L, -2);
-			lua_call(L, 0, 0); //?
+			lua_getfield(L, -1, "_sandbox");
+			lua_call(L, 0, 0);
 		}
 
-		 luax_convobj(L, lua_gettop(L), "thread", "getThread");
-		lua_getglobal(L, "love");
 		lua_pushvalue(L, -2);
 		lua_setfield(L, -2, "_curthread");
 		if(luaL_dostring(L, comm->getCode()) == 1)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.