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

Function GetTableStringValue

engine/script/src/script.cpp:2169–2188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2167 }
2168
2169 const char* GetTableStringValue(lua_State* L, int table_index, const char* key, const char* default_value)
2170 {
2171 DM_LUA_STACK_CHECK(L, 0);
2172 const char* r = default_value;
2173
2174 lua_getfield(L, table_index, key);
2175 if (!lua_isnil(L, -1)) {
2176
2177 int actual_lua_type = lua_type(L, -1);
2178 if (actual_lua_type != LUA_TSTRING) {
2179 dmLogError("Lua conversion expected table key '%s' to be a string but got %s",
2180 key, lua_typename(L, actual_lua_type));
2181 } else {
2182 r = lua_tostring(L, -1);
2183 }
2184
2185 }
2186 lua_pop(L, 1);
2187 return r;
2188 }
2189
2190 int GetTableIntValue(lua_State* L, int table_index, const char* key, int default_value)
2191 {

Callers 1

TEST_FFunction · 0.85

Calls 3

lua_getfieldFunction · 0.85
lua_typeFunction · 0.85
lua_typenameFunction · 0.85

Tested by 1

TEST_FFunction · 0.68