MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / GetBoolInTable

Function GetBoolInTable

src/vm/luavm/lmylib.cpp:243–255  ·  view source on GitHub ↗

get bool field value of table

Source from the content-addressed store, hash-verified

241
242// get bool field value of table
243static bool GetBoolInTable(lua_State *L, const char *pKey, bool &value) {
244 // the top of stack must be a table
245 lua_pushstring(L, pKey);
246 lua_gettable(L, -2); // get the table field by key in top of stack
247 if (!lua_isboolean(L, -1)) {
248 LogPrint(BCLog::LUAVM, "get boolean field of table error! value=%s\n", lua_tostring(L, -1));
249 lua_pop(L, 1); // pop the result of lua_gettable
250 return false;
251 }
252 value = lua_toboolean(L, -1);
253 lua_pop(L, 1); // pop the result of lua_gettable
254 return true;
255}
256
257// get Integer field value of table
258static bool getIntegerInTable(lua_State *L, const char *pKey, lua_Integer &value) {

Callers 1

Calls 3

lua_pushstringFunction · 0.85
lua_gettableFunction · 0.85
lua_tobooleanFunction · 0.85

Tested by

no test coverage detected