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

table.remove problems? Help?

Asked by 10 years ago

I looked on the wiki it didnt help me much to remove strings from the table... :/

Any idea's?

01Owners={'MessorAdmin'};
02 
03Instance_CMD('Unadmin',1,function(Plr,Msg)
04for _,v in pairs(FindReturnPlayer(Plr,Msg)) do -- Returns a table
05---------------------------------------------- 
06for _,p in pairs(Owners) do
07if p:lower()==v.Name:lower() then print(p) -- Returns my name from the FindPlayerTable return.
08table.remove(Owners,_) wait()   -- This is the error line. Im not sure why its not removing my name.
09Note(Plr,'Removed '..Msg..' Admin!',(85/255/0)) -- This outputs after but my name is not removed?!?!?
10end
11end
12---
13end
14end)
0
Could you update the post with the output? VariadicFunction 335 — 10y
0
There is no output error from it. MessorAdmin 598 — 10y

2 answers

Log in to vote
2
Answered by 10 years ago

You have two indexes of _. Hope that helps you out.

*Add an end before you do the other _, whatever in pairs

Ad
Log in to vote
0
Answered by 10 years ago

table.remove() needs 2 arguments: the table, and the position of the thing we're removing. So, do table.remove(Owners,#_) instead of table.remove(Owners,_)

Answer this question