I am creating a cooking game, and currently, when a player joins, a removeEvent fires what’s on each counter to the client that joined the game (these are sent in a format similar to Items = {[Counter][“Item”] = “Tomato”} ).
The problem is, it appears you cannot send mixed tables (non string keys) to the client/server, which I don’t know any alternative to what I am doing, as it is crucial to know what counter the item is on.
Any help?
If a counter is empty, and your counters are indexed sequentially starting at index 1, then you can send an empty table instead of sending nothing at all for that counter.
For example, if you have three counters, and counter 2 is empty, then you can do the following:
FYI, this is exactly the same table as the following:
-- Keys not explicitly specified while creating a table
-- => Keys are sequential, starting at 1
-- i.e. we're declaring an array.
Items = {
{Item = "Tomato"},
{}, -- index 2, counter is empty.
{Item = "Banana"}
}
Alternatively, you can give your counter meaningful ids and avoid the problem altogether.
Items = {
IslandCounter = {Item = "Tomato"},
--KitchenCounter = {}, -- We can omit this safely.
SinkCounter = {Item = "Banana"}
}