Posted 29 December 2014 - 02:22 PM
Hi,
I've been programming my own to-do list system in ComputerCraft (TPPI, survival), and I've stumbled upon something which I suspect is a bug/omission in the Lua implementation:
When I have a function that returns multiple arguments (for instance, term.current().getCursorPos()), and I want to directly use the results by putting them into a table like so:
I get the following error:
While the Lua documentation states that this code should work, on this page, quoting:
Am I doing something wrong, perhaps misreading the documentation? Or is this a bug?
I've been programming my own to-do list system in ComputerCraft (TPPI, survival), and I've stumbled upon something which I suspect is a bug/omission in the Lua implementation:
When I have a function that returns multiple arguments (for instance, term.current().getCursorPos()), and I want to directly use the results by putting them into a table like so:
ct = term.current()
local cy = {ct.getCursorPos()}[1]
I get the following error:
bios:366: [string "board"]:(line nr. of the "local cy..." line): unexpected symbol
While the Lua documentation states that this code should work, on this page, quoting:
function foo0 () end -- returns no results
function foo1 () return 'a' end -- returns 1 result
function foo2 () return 'a','b' end -- returns 2 results
A constructor also collects all results from a call, without any adjustments:
a = {foo0()} -- a = {} (an empty table)
a = {foo1()} -- a = {'a'}
a = {foo2()} -- a = {'a', 'b'}
Am I doing something wrong, perhaps misreading the documentation? Or is this a bug?