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

Function PCallCheckTable

engine/script/src/test/test_script_table.cpp:244–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242 lua_gettop(L) + (i) + 1)
243
244static int PCallCheckTable(lua_State* L, char* buffer, uint32_t buffer_size, int index, bool do_log)
245{
246 index = abs_index(L, index);
247
248 int oldtop = lua_gettop(L);
249 lua_pushcfunction(L, LuaCheckTable);
250 lua_pushvalue(L, index); // add table again...
251 lua_pushlightuserdata(L, buffer);
252 lua_pushnumber(L, buffer_size);
253 int result = lua_pcall(L, 3, 0, 0);
254 if (result != 0) {
255 if (do_log)
256 printf("error %s\n", lua_tostring(L, oldtop + 1));
257 lua_pop(L, 1);
258 }
259 assert(lua_gettop(L) == oldtop);
260 return result;
261}
262
263TEST_F(LuaTableTest, Table01)
264{

Callers 1

TEST_FFunction · 0.85

Calls 6

lua_gettopFunction · 0.85
lua_pushvalueFunction · 0.85
lua_pushlightuserdataFunction · 0.85
lua_pushnumberFunction · 0.85
lua_pcallFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected