• table.remove (number expected, got userdata)
    2 replies, posted
Pretty sure some people probably had this problem in the past but from googling I can't find an answer. In my script I type /strip <player> and it takes a gun from them and adds them to a table (table.insert( Physgun, ply)), which works fine - the problem is trying to remove said player from the table. If i use table.remove with ply as the value i get the error in the title, how can I find that specific player and remove only him from the table? The table is meant to stop abusers from obtaining the Physgun and can only be removed with the other command I am adding. (or a map change I suppose)
The method I think you are looking for is [url=http://wiki.garrysmod.com/page/table/RemoveByValue]table.RemoveByValue[/url]. [i]table.remove[/i] accepts an index, not the value paired with it.
Ah, works good - I was looking at that method but didn't quite understand what it did. Guess I should have just tested it and I wouldn't have made this post =p
Sorry, you need to Log In to post a reply to this thread.