MCPcopy Create free account
hub / github.com/DFHack/dfhack / find_field

Function find_field

library/LuaTypes.cpp:435–454  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

433}
434
435static void *find_field(lua_State *state, int index, const char *mode)
436{
437 lookup_field(state, index, mode);
438
439 // Methods
440 if (lua_isfunction(state, -1))
441 return NULL;
442
443 // Otherwise must be a pointer
444 if (!lua_isuserdata(state, -1))
445 field_error(state, index, "corrupted field table", mode);
446
447 void *p = lua_touserdata(state, -1);
448 lua_pop(state, 1);
449
450 // NULL => metafield
451 if (!p)
452 get_metafield(state);
453 return p;
454}
455
456static int cur_iter_index(lua_State *state, int len, int fidx, int first_idx = -1)
457{

Callers 7

meta_struct_indexFunction · 0.85
meta_struct_newindexFunction · 0.85
find_primitive_fieldFunction · 0.85
meta_global_indexFunction · 0.85
meta_global_newindexFunction · 0.85

Calls 4

lookup_fieldFunction · 0.85
lua_isuserdataFunction · 0.85
lua_touserdataFunction · 0.85
get_metafieldFunction · 0.85

Tested by

no test coverage detected