| 1739 | } |
| 1740 | |
| 1741 | static int DoAttach(lua_State *state) |
| 1742 | { |
| 1743 | lua_newtable(state); |
| 1744 | lua_rawsetp(state, LUA_REGISTRYINDEX, &DFHACK_PTR_IDTABLE_TOKEN); |
| 1745 | |
| 1746 | lua_newtable(state); |
| 1747 | lua_rawsetp(state, LUA_REGISTRYINDEX, &DFHACK_TYPEID_TABLE_TOKEN); |
| 1748 | |
| 1749 | lua_newtable(state); |
| 1750 | lua_rawsetp(state, LUA_REGISTRYINDEX, &DFHACK_ENUM_TABLE_TOKEN); |
| 1751 | |
| 1752 | lua_newtable(state); |
| 1753 | lua_rawsetp(state, LUA_REGISTRYINDEX, &DFHACK_EMPTY_TABLE_TOKEN); |
| 1754 | |
| 1755 | lua_pushcfunction(state, change_error); |
| 1756 | lua_setfield(state, LUA_REGISTRYINDEX, DFHACK_CHANGEERROR_NAME); |
| 1757 | |
| 1758 | lua_pushcfunction(state, meta_ptr_compare); |
| 1759 | lua_setfield(state, LUA_REGISTRYINDEX, DFHACK_COMPARE_NAME); |
| 1760 | |
| 1761 | lua_pushcfunction(state, meta_type_tostring); |
| 1762 | lua_setfield(state, LUA_REGISTRYINDEX, DFHACK_TYPE_TOSTRING_NAME); |
| 1763 | |
| 1764 | lua_rawgetp(state, LUA_REGISTRYINDEX, &DFHACK_TYPETABLE_TOKEN); |
| 1765 | lua_pushcclosure(state, meta_sizeof, 1); |
| 1766 | lua_setfield(state, LUA_REGISTRYINDEX, DFHACK_SIZEOF_NAME); |
| 1767 | |
| 1768 | lua_rawgetp(state, LUA_REGISTRYINDEX, &DFHACK_TYPETABLE_TOKEN); |
| 1769 | lua_pushcclosure(state, meta_displace, 1); |
| 1770 | lua_setfield(state, LUA_REGISTRYINDEX, DFHACK_DISPLACE_NAME); |
| 1771 | |
| 1772 | lua_rawgetp(state, LUA_REGISTRYINDEX, &DFHACK_TYPETABLE_TOKEN); |
| 1773 | lua_pushcclosure(state, meta_new, 1); |
| 1774 | lua_setfield(state, LUA_REGISTRYINDEX, DFHACK_NEW_NAME); |
| 1775 | |
| 1776 | lua_rawgetp(state, LUA_REGISTRYINDEX, &DFHACK_TYPETABLE_TOKEN); |
| 1777 | lua_pushcclosure(state, meta_reinterpret_cast, 1); |
| 1778 | lua_setfield(state, LUA_REGISTRYINDEX, DFHACK_CAST_NAME); |
| 1779 | |
| 1780 | lua_rawgetp(state, LUA_REGISTRYINDEX, &DFHACK_TYPETABLE_TOKEN); |
| 1781 | lua_pushcclosure(state, meta_assign, 1); |
| 1782 | lua_setfield(state, LUA_REGISTRYINDEX, DFHACK_ASSIGN_NAME); |
| 1783 | |
| 1784 | lua_rawgetp(state, LUA_REGISTRYINDEX, &DFHACK_TYPETABLE_TOKEN); |
| 1785 | lua_pushcclosure(state, meta_is_instance, 1); |
| 1786 | lua_setfield(state, LUA_REGISTRYINDEX, DFHACK_IS_INSTANCE_NAME); |
| 1787 | |
| 1788 | lua_rawgetp(state, LUA_REGISTRYINDEX, &DFHACK_TYPETABLE_TOKEN); |
| 1789 | lua_pushcclosure(state, meta_delete, 1); |
| 1790 | lua_setfield(state, LUA_REGISTRYINDEX, DFHACK_DELETE_NAME); |
| 1791 | |
| 1792 | { |
| 1793 | // Assign df a metatable with read-only contents |
| 1794 | lua_newtable(state); |
| 1795 | lua_newtable(state); |
| 1796 | |
| 1797 | // Render the type structure |
| 1798 | RenderTypeChildren(state, compound_identity::getTopScope()); |
nothing calls this directly
no test coverage detected