Commits

Robin Wellner committed 32cc174

Adds sandbox to new threads

Comments (0)

Files changed (2)

src/modules/thread/Thread.cpp

 		}
  		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_getfield(L, -1, "_sandbox");
+			lua_call(L, 0, 0);
+		}
+
 		lua_pushvalue(L, -2);
 		lua_setfield(L, -2, "_curthread");
 		if(luaL_dostring(L, comm->getCode()) == 1)

src/modules/thread/Thread.h

 #include <common/Module.h>
 #include <thread/threads.h>
 
+#ifndef LOVE_SANDBOX
+#define LOVE_SANDBOX
+#include "scripts/sandbox.lua.h"
+#endif // LOVE_SANDBOX
 
 namespace love
 {