[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: How many elements in this table?
- From: Eric Tetz <erictetz@...>
- Date: Sun, 20 Mar 2005 14:25:26 -0800
Ugh, haven't used Lua in a year or so, then discovered I could script
the interface of my game with it (World of Warcraft). Now I have what
feels like a newbie question:
How can I tell the number of elements in table T? I'm not using it as
a list, so table.getn always returns 0. Do I need to write something
function numelements (t)
local n = 0
for k,v in t do
n = n + 1
That seems very kludgey.