lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Nice work Bertrand

I tried to print some complex table. 
table = { __newindex = table }                                          
table[1]="asas"                                                         
table[table]={table = {__newindex=table}} 

and got this.

{ setn = function: 0x8027b00c, insert = function: 0x8027af94, getn = fun
ction: 0x8027af1c, foreachi = function: 0x8027aedc, maxn = function: 0x8
027af58, foreach = function: 0x8027aea0, concat = function: 0x8027ae64, 
remove = function: 0x8027afd0, sort = function: 0x8027b048 }      

I couldn't understand the output.

On Sat, Jun 20, 2009 at 8:11 PM, Matthew Paul Del Buono <delbu9c1@erau.edu> wrote:
Sorry for the spam, somehow this original email got cut off :)

>I really do not like the way you are outputting tables at
all.
>It's way too ambiguous. In fact, two completely different
>tables could actually yield the same exact output.
>
>> a = {}; b = {}; c = {}; a.b = b; b.c = c; c.b = b; print(a)
>{ b = { c = { b = {<self> } } } }
>> a = {}; b = {}; c = {}; a.b = b; b.c = c; c.b = a; print(a)
>{ b = { c = { b = {<self> } } } }
>
>There are many solutions to this, though none of them are
>exactly what I'd call "easy." However, I personally think
it's
>better to output the Lua interpreter-style "table:
0x12345678"
>than it is to try to dump this out if it's going to be
>ambiguous like this.
>
>Aside from this, except for the loadstring() issues
previously
>mentioned, you seem to be fairly decently locked down, but
>unless you got assistance from

... some of the people that have built Lua bots, etc. in the
past, I do hope you've had a few other people take a look at
the code already. In my experience testing these types of
tools, it's never right on the first pass (there's always
something hidden to get around in there).


On a similar note, in my attempts to break through your
sandbox, I noticed that your output is not respecting the
__tostring metamethod on tables. Is this intentional?

-- Matthew P. Del Buono
Embry-Riddle Aeronautical University
EcoEagles, Software Team Leader