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

Method IndexStatics

library/LuaTypes.cpp:1550–1574  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1548}
1549
1550void LuaWrapper::IndexStatics(lua_State *state, int meta_idx, int ftable_idx, struct_identity *pstruct)
1551{
1552 // stack: metatable fieldtable
1553 AddFieldInfoTable(state, ftable_idx, pstruct);
1554 for (const struct_identity *p = pstruct; p; p = p->getParent())
1555 {
1556 auto fields = p->getFields();
1557 if (!fields)
1558 continue;
1559
1560 for (int i = 0; fields[i].mode != struct_field_info::END; ++i)
1561 {
1562 switch (fields[i].mode)
1563 {
1564 case struct_field_info::CLASS_METHOD:
1565 AddMethodWrapper(state, meta_idx, ftable_idx, fields[i].name,
1566 (function_identity_base*)fields[i].type);
1567 break;
1568
1569 default:
1570 break;
1571 }
1572 }
1573 }
1574}
1575
1576/**
1577 * Make a struct-style object metatable.

Callers

nothing calls this directly

Calls 2

AddFieldInfoTableFunction · 0.85
AddMethodWrapperFunction · 0.85

Tested by

no test coverage detected