How to get number of entries in a Lua table?
You already have the solution in the question — the only way is to iterate the whole table with pairs(..). Also, notice that the “#” operator’s definition is a bit more complicated than that. Let me illustrate that by taking this table: According to the manual, any of 3, 5 and 9 are valid results for #t. The only … Read more