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

Function RefInInstance

engine/script/src/script.cpp:1358–1388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1356 }
1357
1358 int RefInInstance(lua_State* L)
1359 {
1360 // [-1] value
1361 DM_LUA_STACK_CHECK(L, -1);
1362
1363 GetInstanceContextTable(L);
1364 // [-2] value
1365 // [-1] instance context table or LUA_NIL
1366
1367 if (lua_type(L, -1) != LUA_TTABLE)
1368 {
1369 // [-2] value
1370 // [-1] LUA_NIL
1371
1372 lua_pop(L, 2);
1373 return LUA_NOREF;
1374 }
1375 // [-2] value
1376 // [-1] instance context table
1377
1378 lua_insert(L, -2);
1379 // [-2] instance context table
1380 // [-1] value
1381
1382 int instance_ref = luaL_ref(L, -2);
1383 // [-1] instance context table
1384
1385 lua_pop(L, 1);
1386
1387 return instance_ref;
1388 }
1389
1390 void UnrefInInstance(lua_State* L, int ref)
1391 {

Callers 5

TEST_FFunction · 0.85
Http_RequestFunction · 0.85
Http_RequestFunction · 0.85
Sound_PlayFunction · 0.85
SpriteComp_PlayFlipBookFunction · 0.85

Calls 4

GetInstanceContextTableFunction · 0.85
lua_typeFunction · 0.85
lua_insertFunction · 0.85
luaL_refFunction · 0.85

Tested by 1

TEST_FFunction · 0.68