get bool field value of table
| 241 | |
| 242 | // get bool field value of table |
| 243 | static 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 |
| 258 | static bool getIntegerInTable(lua_State *L, const char *pKey, lua_Integer &value) { |
no test coverage detected