Hi List,
I am trying to program with Lua but there are concepts I must not understand, and the documentation is somewhat lacking.
The only useful thing I could use is Hans' manual, thanks to him.
If someone could help me just understanding the concept I must me missing in this simple example I would appreciate it.
So here it is.
Running the following code, variable "a" should not be modified by my function, and stay (1,2), but it does get modified and becomes (4,2) like the new variable "b" I am creating.
What is wrong with my code ?
Thank you for any hint !
Mathieu
\starttext
\startluacode
function myFunc(arg)
local var = arg
var[1] = var[1] + 3
return var
end
local a = {1,2}
context("a = \\{")
context(a[1])
context(",\\;")
context(a[2])
context("\\}\\par")
context("\\blank")
local b = myFunc(a)
context("a = \\{")
context(a[1])
context(",\\;")
context(a[2])
context("\\}\\par")
context("\\blank")
context("b = \\{")
context(b[1])
context(",\\;")
context(b[2])
context("\\}\\par")
\stopluacode
\stoptext