Hi, so I currently finished an AdminSystem and wanted for better efficiency get all the Names for the different ModStages from a ModuleScript. But Im occuring now not all Names when trying to print the “Whitelist” Table.
table.unpack returns variable arguments. Variable arguments drop everything after the first argument if you add something after, so only the very last unpack will have all its array contents dropped into the table however anything before it will only get the first entry.
You can fix this by manually adding the elements into your main table (consider table.move). I personally save some kind of data on the player about their status and work based off of that but that’s a more intricate solution designed for a wider range of uses than I’d be willing to explain here.
Well I see the problem and I know now where the problem is, but the weird thing is that the table “Supporter” is fully included into the “Whitellist” Table print with having more than 1 string in it
The details are in the post I made, you can’t chain variable arguments like this as everything will get dropped after a comma. It’s not weird, it’s intended behaviour. You will have to manually compose the contents together or figure out a different way to represent this data for the player.
Don’t see what you mean there. You need to read the output you’re seeing and compare it to the details that I’ve given you to see. Supporter is the last table in your unpack list so its elements don’t get dropped because it can fill variable space at the end. The other two are clamped.
You’re unpacking the tables Unlimited, Moderator and Supporter in that order. Note that your output order is “Faustollol” (Unlimited index 1), “Player2” (Moderator index 1), “Player3” (Supporter index 1), “Player4” (Supporter index 2) and “another2” (Supporter index 3). “Player1”, “another” and “another3” aren’t in the resulting table because they aren’t the first element of Unlimited or Moderator and there is another argument proceeding their unpacking.
This:
Happens because Supporter is the last unpack. Change the order of the unpacks around and you’ll see the same behaviour of all the elements of the tables that aren’t last getting dropped beyond the first argument.
Ahhh ok that makes sense now. Thanks. But table.move wont work because then I would have another table in my table and that would mess everything up. I also looked up to table.concat and table.copy but all these wont work here. Is there any other method I can try?
Found out that I can just easily insert all values throught pairs loops.
wait(1)
local Module = require(game:GetService("ReplicatedStorage"):WaitForChild("Money/AdminRS").ModuleMain)
for i, v in pairs(Module.Supporter) do
if v ~= nil then
table.insert(Module.Whitelist, v)
end
end