MCPcopy Create free account
hub / github.com/defold/defold / LuaCallCallback

Function LuaCallCallback

engine/script/src/test/test_script_lua.cpp:177–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177static int LuaCallCallback(lua_State* L)
178{
179 luaL_checktype(L, -1, LUA_TFUNCTION);
180 lua_pushvalue(L, 1);
181 lua_setglobal(L, "_callback");
182 lua_pushlightuserdata(L, L);
183 lua_setglobal(L, "_state");
184 return 0;
185}
186
187/*
188 * This test mimicks how callbacks are handled in extensions, with respect to coroutine safety

Callers

nothing calls this directly

Calls 3

luaL_checktypeFunction · 0.85
lua_pushvalueFunction · 0.85
lua_pushlightuserdataFunction · 0.85

Tested by

no test coverage detected