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

problem with table.remove??

Asked by 9 years ago

I dont have any error, but why would the table.remove not be removing the player's name?

Pet(Plr,'Deep orange','Clear PrivateServer List?',function()
Dismiss(Plr)
local Run,Error = ypcall(function()
for i = 0,#Dergan['PrivateServer_People'],1 do
table.remove(Dergan['PrivateServer_People'],i[1])
end
end)
if not Run then Pet(Plr,'Deep orange','WARNING : '..Error,function() end) end
Dismiss(Plr)
Pet(Plr,'Lime green','Updated Private Server List!',function() end)
Pet(Plr,'New Yeller','Back',function() GetPrivateServer(Plr) end)
end)

1 answer

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
9 years ago

I'm not really sure what you're trying to do here, but the easiest way to clear a table is to just set it to an empty one. Also, format your code bro. Untabbed code is difficult to read.

Pet(Plr,'Deep orange','Clear PrivateServer List?',function()
    Dismiss(Plr)
    local Run,Error = ypcall(function()
--  for i = 0,#Dergan['PrivateServer_People'],1 do
--      table.remove(Dergan['PrivateServer_People'],i[1])
--  end
    Dergan['PrivateServer_People'] = {}
end)
if not Run then Pet(Plr,'Deep orange','WARNING : '..Error,function() end) end
Dismiss(Plr)
Pet(Plr,'Lime green','Updated Private Server List!',function() end)
Pet(Plr,'New Yeller','Back',function() GetPrivateServer(Plr) end)
end) --?
Ad

Answer this question