lua-users home
lua-l archive

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


----- Original Message -----
From: "Philippe Lhoste" <PhiLho@gmx.net>
To: <lua@bazar2.conectiva.com.br>
Sent: Thursday, July 17, 2003 11:38 AM
Subject: Re: The most stupid thing you've done with Lua?


> It depends on what you call "useless"... It is almost a philosophical
> question!

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
)

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 ;-)

Challenge (I don't think it's too complex): write a shorter prog with the
same purpose.

Yes, it's useless, but fun, isn't it? ;)