lua-users home
lua-l archive

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


>Speaking of useless scripts, the following Lu5 code prints out itself.
>s=[[s=[[x]]s=string.gsub(s,"x",s,1)print(s)]]s=string.gsub(s,"x",s,1)print(s
>)

See also http://www.nyx.net/~gthompso/self_lua.txt .

>This is a well known task to write a program that prints out its code. I
>think Lua has to pass the stage of writing such a program in it ;-)

See also http://www.nyx.net/~gthompso/quine.htm .
--lhf