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

Function getIntegerInTable

src/vm/luavm/lmylib.cpp:258–270  ·  view source on GitHub ↗

get Integer field value of table

Source from the content-addressed store, hash-verified

256
257// get Integer field value of table
258static bool getIntegerInTable(lua_State *L, const char *pKey, lua_Integer &value) {
259 // the top of stack must be a table
260 lua_pushstring(L, pKey);
261 lua_gettable(L, -2); // get the table field by key in top of stack
262 if (!lua_isinteger(L, -1)) {
263 LogPrint(BCLog::LUAVM, "get integer field of table error! value=%s\n", lua_tostring(L, -1));
264 lua_pop(L, 1); // pop the result of lua_gettable
265 return false;
266 }
267 value = lua_tointeger(L, -1);
268 lua_pop(L, 1); // pop the result of lua_gettable
269 return true;
270}
271
272static bool getNumberInTable(lua_State *L, const char* pKey, double &ret) {
273 // 在table里,取指定pKey对应的一个number值

Callers 1

ParseUidTypeInTableFunction · 0.85

Calls 3

lua_pushstringFunction · 0.85
lua_gettableFunction · 0.85
lua_isintegerFunction · 0.85

Tested by

no test coverage detected