Пример #1
0
int luaA_struct_push_typeid(lua_State* L, luaA_Type type,const void* c_in) {

  struct_entry* se = luaA_hashtable_get(struct_table, luaA_type_name(type));
  if (se != NULL) {
    
    lua_newtable(L);
    
    for(int j = 0; j < se->num_members; j++) {
      struct_member_entry* sme = se->members[j];
      luaA_struct_push_member_name_typeid(L, type, c_in, sme->name);
      lua_setfield(L, -2, sme->name);
    }
    return 1;
  }
  
  lua_pushfstring(L, "lua_autostruct: Struct '%s' not registered!", luaA_type_name(type));
  lua_error(L);
  return 0;
}
Пример #2
0
static int lautoc_struct_index(lua_State *L)
{
  return luaA_struct_push_member_name_typeid(L, lua_tonumber(L,lua_upvalueindex(1)), lua_touserdata(L,-2), lua_tostring(L,-1));
}