So as you might or might not have known, a quine program is a program that outputs it’s own source code. Since this is a lua scripting thread, I thought you guys might be interested in the lua quine code!
(deprecated)
[lua]
y = [[ print(“y = [[” … y … “]]
dostring(y)”) ]]
dostring(y)
[/lua]
(working)
[lua]
s=[[io.write(‘s=[’,’[’,s,’]’,’];’,s)]];io.write(‘s=[’,’[’,s,’]’,’];’,s)
[/lua]
Tada! Try it out yourself at http://www.lua.org/cgi-bin/demo
Or here’s the hypothetical version of the quine code:
[lua]
s=print(s=print(s=print(s=print( --It goes on infinitely
[/lua]