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

Function SetInstanceContextValue

engine/script/src/script.cpp:1289–1320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1287 }
1288
1289 bool SetInstanceContextValue(lua_State* L)
1290 {
1291 // [-2] key
1292 // [-1] value
1293
1294 DM_LUA_STACK_CHECK(L, -2);
1295
1296 GetInstanceContextTable(L);
1297 // [-3] key
1298 // [-2] value
1299 // [-1] instance context table or LUA_NIL
1300
1301 if (lua_type(L, -1) != LUA_TTABLE)
1302 {
1303 lua_pop(L, 3);
1304 return false;
1305 }
1306 // [-3] key
1307 // [-2] value
1308 // [-1] instance context table
1309
1310 lua_insert(L, -3);
1311 // [-3] instance context table
1312 // [-2] key
1313 // [-1] value
1314
1315 lua_settable(L, -3);
1316 // [-1] instance context table
1317
1318 lua_pop(L, 1);
1319 return true;
1320 }
1321
1322 void GetInstanceContextValue(lua_State* L)
1323 {

Callers 8

TestSetInstanceContextFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85

Calls 4

GetInstanceContextTableFunction · 0.85
lua_typeFunction · 0.85
lua_insertFunction · 0.85
lua_settableFunction · 0.85

Tested by 6

TestSetInstanceContextFunction · 0.68
TEST_FFunction · 0.68
TEST_FFunction · 0.68
TEST_FFunction · 0.68