lua-users home
lua-l archive

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


Hi Julien,

> * PROPOSAL 1: Create a JSON-like Lua-compatible format (we can call it LTN for Lua Table Notation or LuT for LuaTable or whatever you want).

I don't think JSON is a good example as it is too limited for what Lua
data structures can handle. JSON doesn't handle shared or circular
references, can not handle tables with keys of various types, and
doesn't even allow to distinguish between 1.5 and '1.5' as a key as
all the keys are strings (http://tools.ietf.org/html/rfc4627).
Somebody described it as a data-exchange, rather than a serialization
language, which I agree with.

If you need something more powerful than JSON, then why don't just use
the data structures that Lua already provides?

> * PROPOSAL 2: Change the behavior of dofile, load, loadfile, etc. so that if the source only contains a table, the returned chunk returns this table.
> local position = load(“{ x = 5, y = 10 }”)()

Maybe I'm missing something, but why not prepend "return" either in
your module (return {5, y=10}) or in your load() code?

Paul.

On Thu, Jun 28, 2012 at 2:22 PM, Julien Duminil
<julien.duminil@ubisoft.com> wrote:
> Hi List,
>
> Here is my two-in-one proposal :