01.06.2016, 09:55
You should store your table as a storage variable, not every client a separate variable:
You should also check for disconnected clients, otherwise your table will be growing forever which will cause issues in the future. You can also use IP address as table key, so you can set and remove items without having to iterate through the table:
Code:
t = {}
-- insert values into t
...
-- save to storage
storage.set('clients', t)
You should also check for disconnected clients, otherwise your table will be growing forever which will cause issues in the future. You can also use IP address as table key, so you can set and remove items without having to iterate through the table:
Code:
t[ ip1 ] = true -- client connected
t[ ip2 ] = nil -- client disconnected