I’m getting that error every time I attempt to run this code;
[lua]
function PrintInventory(ply)
local inventory = string.split(ply:GetNWString(“inventory”), “,”)
for k, v in pairs(inventory) do
Msg("K: “…k…” V: “…v…”
")
end
end
[/lua]
Can anyone help?
Can you specify what line this code is erring on?
Line 2.
I thought it may be that I’m trying to perform string.split whilst getting a NWString but remedying this didn’t fix it as I also tried;
[lua]
local nwInventory = ply:GetNWString(“inventory”)
local inventory = string.split(nwInventory, “,”)
[/lua]
Use string.Explode, AFAIK string.split is a fucked up function.
How so? It just inverts the argument order and returns the result of string.Explode [Source].
The string split in there is uppercase S, whereas a lowercase s appears to be some builtin lua function.