This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
MindenCucc's profile picture

Lua interpreter

Started by MindenCucc, 08 August 2015 - 01:39 PM
MindenCucc #1
Posted 08 August 2015 - 03:39 PM
HI!

There's a tiny bug that exists in CC1.74's lua program, where you can call the function with )( as you can with ()

Proof:


http://puu.sh/jtXny/882884fac2.png
SquidDev #2
Posted 08 August 2015 - 03:45 PM
The key line is:

local func = load("return _echo(" .. code .. ")")
Which gets translated to:

load("return _echo(print)()")
Seeing as all the _echo function does is return its arguments (why it is there I don't know?) you then ending up with calling the result so:

load("return (print)()")
Haven't tested but I wonder if:

print,2,3)(
will print an empty line.

Not really a bug though, just an undocumented feature :P/>.
Edited on 08 August 2015 - 01:45 PM