#Remote event destroying array

1 messages · Page 1 of 1 (latest)

queen ivy
#

When I send a table over a remote event, any entries after a nil entry are.. SOMETIMES just removed from the table. I'm not sure if this is intended but it's been causing tons of issues and it took me forever to figure out what was causing it.

#

Server sees it fine, client gets this:

#

if i have [1], [2]. etc. no problem. if i have [1].[8], etc, it doesnt send anything after 1.

#

what should i do here? just fill all slots with just [2] "I AM EMPTY!!!" ?

versed obsidianBOT
#

studio** You are now Level 5! **studio

queen ivy
#

I guess i can just swap around to be

                     = [count]

so there wont ever be any nil entries

#

and move maxstack somewhere else because it shouldnt be there anyways

#

OOOR I can be a hacky piece of shi and just convert the entries into strings before sending and then convert back to numbered again on the client

#

so i dont have to refactor ..

#

fuck it im gonna be evil its funny

#
local function stringifySlots(slots) --THE EVIL HACK IN QUESTION
    local result = {}
    for index, data in pairs(slots) do
        result[tostring(index)] = data
    end
    return result
end

local function numberifySlots(slots)
    local result = {}
    for key, data in pairs(slots) do
        local numKey = tonumber(key)
        if numKey then
            result[numKey] = data
        end
    end
    return result
end