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

Function GetTestScriptExtension

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

Source from the content-addressed store, hash-verified

866uint32_t TestScriptExtension::m_FinalizeScriptInstancedCalled = 0;
867
868static TestScriptExtension* GetTestScriptExtension(dmScript::HContext context)
869{
870 lua_State* L = dmScript::GetLuaState(context);
871 DM_LUA_STACK_CHECK(L, 0);
872
873 lua_pushinteger(L, (lua_Integer)dmHashBuffer32("__TestScriptExtension__", strlen("__TestScriptExtension__")));
874 dmScript::GetContextValue(context);
875 int ref = lua_tonumber(L, 1);
876 lua_pop(L, 1);
877 lua_rawgeti(L, LUA_REGISTRYINDEX, ref);
878 TestScriptExtension* extension = (TestScriptExtension*)(lua_touserdata(L, -1));
879 lua_pop(L, 1);
880 return extension;
881}
882
883void TestScriptExtensionInitialize(dmScript::HContext context)
884{

Callers 3

Calls 7

lua_pushintegerFunction · 0.85
GetContextValueFunction · 0.85
lua_tonumberFunction · 0.85
lua_rawgetiFunction · 0.85
lua_touserdataFunction · 0.85
GetLuaStateFunction · 0.50
dmHashBuffer32Function · 0.50

Tested by

no test coverage detected