quasiquote/quote in lua?
Posted
by anon
on Stack Overflow
See other posts from Stack Overflow
or by anon
Published on 2010-04-30T20:24:25Z
Indexed on
2010/04/30
20:27 UTC
Read the original article
Hit count: 191
lua
|quasiquote
In Lisp, I can have:
(a b c d e f g)
which means
look up b, c, d, e, f, g
look up a; apply value of a to above
Then, I can also have:
`(a b c d e f g)
which is the equiv to
(list 'a 'b 'c 'd 'e 'f 'g)
Now, in lua, I can have:
[snipplet 1]
foo = {
Foo,
{Cat, cat},
{Dog, dog}
};
Which ends up most likely expanding into: { nil, { nil, nil}, {nil, nil}}
Whereas what I really want is something like:
[snipplet 2]
{ "Foo", {"Cat", "cat"}, {"Dog", "dog"}}
Is there some backquote-like method in lua?
I find [snipplet 1] to be more visually pleasing than [snipplet 2], but what I mean is snipplet 2.
Thanks!
© Stack Overflow or respective owner