コード例 #1
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);
            }
        }
    }
コード例 #2
0
    private void push_data(Sio.SDataBuff data, IntPtr L, NParam o)
    {
        switch (data.type)
        {
        case SType.stype_bool:
            LuaAPI.lua_pushboolean(L, data.boolValue);
            break;

        case SType.stype_uchar:
            LuaAPI.xlua_pushuint(L, data.ucharValue);
            break;

        case SType.stype_char:
            LuaAPI.xlua_pushinteger(L, data.charValue);
            break;

        case SType.stype_short:
            LuaAPI.xlua_pushinteger(L, data.shortValue);
            break;

        case SType.stype_ushort:
            LuaAPI.xlua_pushuint(L, data.ushortValue);
            break;

        case SType.stype_int:
            LuaAPI.xlua_pushinteger(L, data.intValue);
            break;

        case SType.stype_uint:
            LuaAPI.xlua_pushuint(L, data.uintValue);
            break;

        case SType.stype_float:
            LuaAPI.lua_pushnumber(L, data.floatValue);
            break;

        case SType.stype_double:
            LuaAPI.lua_pushnumber(L, data.doubleValue);
            break;

        case SType.stype_long:
            LuaAPI.lua_pushint64(L, data.longValue);
            break;

        case SType.stype_string:
            LuaAPI.lua_pushstring(L, data.stringValue);
            break;

        case SType.stype_list:
            push_list(data, o, L);
            break;

        case SType.stype_map:
            push_map(data, o, L);
            break;

        default:
            Logger.LogError("push_data error!!!!!!!!!!!!!!! type:" + data.type.ToString());
            break;
        }
    }
コード例 #3
0
 private void push_to_lua(NParam o, MemoryStream ms, IntPtr L)
 {
     Sio.SDataBuff data = new Sio.SDataBuff();
     data.UnSerializ(ms);
     push_data(data, L, o);
 }