Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can you create a table within a table via script? [FIXED]

Asked by 10 years ago
module.AddToCharacterSlot1Table = function ()
i = 1
repeat
openslot = currentcstable[i]
i = i + 1
until openslot == nil
openslotnumber = i
print(openslotnumber)
----------------------------Finds Open Slot
currentcstable[openslotnumber][1] = name     ----------Error Line
currentcstable[openslotnumber][2] = value

for key, value in pairs (currentcstable) do
print(key, "=", value)
end

end

Error Below

15:52:25.158 - ServerScriptService.LeaderstatsAndSaving.Table:36: attempt to index field '?' (a nil value)
15:52:25.158 - Stack Begin
15:52:25.158 - Script 'ServerScriptService.LeaderstatsAndSaving.Table', Line 36 - field AddToCharacterSlot1Table
15:52:25.159 - Script 'ServerScriptService.LeaderstatsAndSaving.Table.Handle', Line 19
15:52:25.159 - Stack End
15:52:25.159 - Disconnected event because of exception

This is the error I get, any suggestions or answers?

Edit 2

Forgot to define variables in module script, had nothing to do with tables

Answer this question