Beispiel #1
0
    private void push_map(SDataBuff data, NParam o, IntPtr L)
    {
        SMapReader pmap = data.mapReader;

        LuaAPI.lua_newtable(L);
        if (pmap != null && o.DType == ParamType.ptype_object)
        {
            NStruct ps = NStructManager.GetInstance().Find(o.TypeName);
            if (ps != null)
            {
                SDataBuff k = new SDataBuff();
                SDataBuff v = new SDataBuff();
                while (pmap.Next(k, v))
                {
                    NParam p = ps.Get(k.intValue);
                    if (p != null)
                    {
                        LuaAPI.lua_pushstring(L, p.Name);
                        push_data(v, L, p);
                        LuaAPI.xlua_psettable(L, -3);
                    }
                }
            }
        }
    }
Beispiel #2
0
    private void push_list(SDataBuff data, NParam o, IntPtr L)
    {
        Sio.SListReader plist = data.listReader;
        LuaAPI.lua_newtable(L);
        int top_index = LuaAPI.lua_gettop(L);
        int luaindex  = 0;

        if (plist != null && o.Container == ParamContainer.pparam_container_list)
        {
            Sio.SDataBuff d = new Sio.SDataBuff();
            while (plist.Next(d))
            {
                push_data(d, L, o);
                LuaAPI.xlua_rawseti(L, top_index, ++luaindex);
            }
        }
    }