Overkillz Posted September 28, 2017 Share Posted September 28, 2017 The question is simple. Why it doesn't get empty only using tableExample = {} Well, I have a table, but when I want to clean it (Leave it empty) it doesn't work tableExample = { {"spawnpoint","425","3759.4814","-1384.124","7.75377","0","359.94","60"}, {"spawnpoint","425","3753.4814","-1387.124","8.75377","0","359.94","60"}, {"spawnpoint","425","3751.4814","-1382.124","9.75377","0","359.94","60"}, {"spawnpoint","425","3749.4814","-1389.124","10.75377","0","359.94","60"} } -- Why doesn't this work ? It should be enought to clean it right ? It still keeping the same spawnpoints if I update it by another table. tableExample = {} Link to comment
Rockyz Posted September 28, 2017 Share Posted September 28, 2017 Everything here is correct show us the problem line Link to comment
!#NssoR_) Posted September 28, 2017 Share Posted September 28, 2017 Your code is true. I tried this example and then everything was good : tableExample = { {"spawnpoint","425","3759.4814","-1384.124","7.75377","0","359.94","60"}, {"spawnpoint","425","3753.4814","-1387.124","8.75377","0","359.94","60"}, {"spawnpoint","425","3751.4814","-1382.124","9.75377","0","359.94","60"}, {"spawnpoint","425","3749.4814","-1389.124","10.75377","0","359.94","60"} } addCommandHandler('s', function () if ( #tableExample > 0 ) then for i , v in pairs ( tableExample ) do outputChatBox(v[1],root,252,225,252,true) end else outputChatBox('There is nothing into this table !!!',root,252,225,252,true) end end) addCommandHandler('d', function () if ( #tableExample > 0 ) then tableExample = { } outputChatBox('The table was cleaned !',root,252,225,252,true) else outputChatBox('The table is empty !',root,252,225,252,true) end end ) Type 's' to shows you the result on the chatbox and type 'd' to delete everything within the table. Link to comment
Overkillz Posted September 28, 2017 Author Share Posted September 28, 2017 Sorry, my mistake. I was triggering a table from a client which wasn't empty. Thanks for answering. Regards. 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now