[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: foreachi and artificial tables
- From: Dave Bollinger <DBollinger@...>
- Date: Sun, 8 Aug 1999 12:10:56 -0400
Hi Mike,
>> Redefining getn() would be more problematic, as it would need to
>> detect whether or not it was working on a "special" table.
This is one of my favorite aspects of Lua. :-) I frequently use it to
redefine tostring() so I can easily print debug dumps of custom structures.
There's lots of uses. Your getn() might look something like:
function getn(t)
if (tag(t) == MySpecialTag)) then
return MySpecialGetN(t)
else
return %getn(t)
end
end
Cheers,
Dave