So, it seems that actual Lua documentation is quite sparse yet again, I have a guy I’m teaching Lua, and the best way he could think of to see if a dictionary was empty was to do a pairs loop through it, I think it’d be at least a marginal benefit to add next() to the wiki, and a short description about how it can be used to check if a dictionary or sparse table is empty, because the return value will be nil if there is no value in that table:
local Dictionary = {[“Builderman”] = 1, [“John”] = “Blamed”}
print(next(Dictionary)) → “Builderman” 1
local EmptyDictionary = {}
print(next(EmptyDictionary)) → nil nil
And hey, maybe people here may not even know they can use next like this, it’s a decent optimization, and it makes code nice and clean