lua-users home
lua-l archive

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


On Sun, Jun 21, 2009 at 3:11 AM, 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> } } } }

That's true, it's not clear which is the reference of which. I think this can be fixed in a future version. Still I prefer to keep the output that way because my intention is to make this tool a tutorial for Lua beginners, so the output has to be easy to understand. But I have other dump functions that make a better job, I'll probably use them.
 

>
>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?

Table, string and others are restored to their initial state between invokations. I will probably return an error message when one try to change them.

--
Bertrand Mansion
Mamasam