lua-users home
lua-l archive

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


On Wednesday, July 25, 2012 10:08:20 AM Jorge wrote:
> 
> As a starting point, http://www.nyx.net/~gthompso/quine.htm
> 
> -----------------------------------
> Language:Lua http://www.tecgraf.puc-rio.br/lua/
> 
> 
> Author:Roberto Ierusalimschy
> 
> y = [[ print("y = [[" .. y .. "]]\ndostring(y)") ]]
> dostring(y)
> -----------------------------------

Nested strings and dostring aren't in Lua 5.2

    y=[[print("y=[["..y.."]".."]load(y)()")]]load(y)()


Format %q makes it easy, but because of the name it comes out longer.

    y="y=%qprint(string.format(y,y))"print(string.format(y,y))

Using only print,

	y=[[print("y=[["..y.."]".."]",y)]] print("y=[["..y.."]".."]",y)

Note there's a tab before 'print', so 64 bytes.

-- 
tom <telliamed@whoopdedo.org>