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

Function GetTableIntValue

engine/script/src/script.cpp:2190–2209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2188 }
2189
2190 int GetTableIntValue(lua_State* L, int table_index, const char* key, int default_value)
2191 {
2192 DM_LUA_STACK_CHECK(L, 0);
2193 int r = default_value;
2194
2195 lua_getfield(L, table_index, key);
2196 if (!lua_isnil(L, -1)) {
2197
2198 int actual_lua_type = lua_type(L, -1);
2199 if (actual_lua_type != LUA_TNUMBER) {
2200 dmLogError("Lua conversion expected table key '%s' to be a number but got %s",
2201 key, lua_typename(L, actual_lua_type));
2202 } else {
2203 r = lua_tointeger(L, -1);
2204 }
2205
2206 }
2207 lua_pop(L, 1);
2208 return r;
2209 }
2210
2211 bool CheckBoolean(lua_State* L, int index)
2212 {

Callers 1

TEST_FFunction · 0.85

Calls 4

lua_getfieldFunction · 0.85
lua_typeFunction · 0.85
lua_typenameFunction · 0.85
lua_tointegerFunction · 0.85

Tested by 1

TEST_FFunction · 0.68