lua-users home
lua-l archive

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


Reuben Thomas wrote:
>
> So maybe I only want to
> be able to modify simple statements, not blocks. I haven't really thought
> through what I'd do with it yet; it just seemed that blocks could easily be
> the same as tables, and that would remove another irregularity from Lua/Sol.

I think, in these kind of language you simply have this irregularity.
Maybe you've been too long in the Lisp camp? ;)

If you really want something like that, what about this?

x = code[[ for i=1,$n do $body end  write"done\n"]]
x.n=5
x.body=code[[write(i)]]
x(foo)
-->12345done

This should be possible within Lua.

Ciao, ET.


PS: Btw, why does dostring rejects precompiled code at the moment?  Is it
considered too dangerous?  Afaics it should work.