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

Function field_reference

library/LuaTypes.cpp:550–584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

548}
549
550static void field_reference(lua_State *state, const struct_field_info *field, void *ptr)
551{
552 switch (field->mode)
553 {
554 case struct_field_info::PRIMITIVE:
555 case struct_field_info::SUBSTRUCT:
556 push_object_internal(state, field->type, ptr);
557 get_object_ref_header(state, -1)->field_info = field;
558 return;
559
560 case struct_field_info::POINTER:
561 push_adhoc_pointer(state, ptr, field->type);
562 return;
563
564 case struct_field_info::OBJ_METHOD:
565 case struct_field_info::CLASS_METHOD:
566 // error
567
568 case struct_field_info::CONTAINER:
569 read_field(state, field, ptr);
570 return;
571
572 case struct_field_info::STATIC_STRING:
573 case struct_field_info::STATIC_ARRAY:
574 case struct_field_info::STL_VECTOR_PTR:
575 GetAdHocMetatable(state, field);
576 push_object_ref(state, ptr);
577 return;
578
579 case struct_field_info::END:
580 break;
581 }
582
583 lua_pushnil(state);
584}
585
586static void write_field(lua_State *state, const struct_field_info *field, void *ptr, int value_idx)
587{

Callers 2

Calls 3

read_fieldFunction · 0.85
GetAdHocMetatableFunction · 0.85
lua_pushnilFunction · 0.85

Tested by

no test coverage detected