void ExecuteScript(std::string Script) { Script = "spawn(function() " + Script + " end)"; Script = replace_all1(Script, "Game:", "game:"); Script = replace_all1(Script, "game:GetObjects", "GetObjects"); if (luaL_loadstring(m_L, Script.c_str())) { std::string Error = lua_tostring(m_L, -1); printf("Error: %s\n", Error); r_lua_getglobal(m_rL, "warn"); r_lua_pushstring(m_rL, Error.c_str()); r_lua_pcall(m_rL, 1, 0, 0); r_lua_settop(m_rL, 0); } else { lua_pcall(m_L, 0, 0, 0); } UserDataGC(m_L); } int custom_loadstring(lua_State* L) { if (lua_type(L, -1) != LUA_TSTRING) { luaL_error(L, "(Bad Argument) - 'loadstring' only accepts 1 argument (string)."); return 0; } if (lua_gettop(L) == 0) { luaL_error(L, "'loadstring' needs 1 string argument."); return 0; } ExecuteScript(std::string(lua_tostring(L, -1))); return 0; } /* I could do better but fuck it, its for Axon. Who cares how stable it is. */ static int Custom_GetObjects(lua_State* L) { auto asset = lua_tostring(L, -1); auto hold = std::string("return {game:GetService('InsertService'):LoadLocalAsset('") + std::string(asset) + std::string("')}"); luaL_dostring(L, hold.c_str()); return 1; } **To register the GetObjects ad loadstring do:** lua_register(m_L, "loadstring", custom_loadstring); lua_register(m_L, "getobjects", Custom_GetObjects); luaL_dostring(m_L, "function GetObjects(assetId) local obj = game:GetService('InsertService'):LoadLocalAsset(assetId) return { obj }; end");```