|
Sam Roberts wrote:
Lua is scheme-minimalist in many ways, but one thing the lisps have usually provided (always?) is data marshalling. You can write and read recursive data structures natively. I know, there are dozens of implementations of this out there for lua... but maybe thats a bad thing.
That's funny, I just updated my DumpObject script, to sport a nicer (more compact) representation of empty table. I also corrected a bug (non-matching quotes in tostring output for functions and other special data).
http://lua-users.org/wiki/PhilippeLhoste Not that anybody care, but hey! :-DI had to write a small function to test if a table is empty. Did I miss something more straightforward? I recall some discussions around this point, but not the final word on the topic...
function IsTableEmpty(t) local c = 0 for k, v in pairs(t) do c = c + 1 end return c == 0 end My script is still in Lua 5.0 (works fine in Lua 5.1 too). -- Philippe Lhoste -- (near) Paris -- France -- http://Phi.Lho.free.fr -- -- -- -- -- -- -- -- -- -- -- -- -- --