daurnimator / lua.vm.js

The project is superceded by Fengari. See https://fengari.io/
MIT License
836 stars 101 forks source link

"arg" doesn't work #29

Closed blackmiaool closed 9 years ago

blackmiaool commented 9 years ago

Variable number of arguments("..." and "arg") doesn't work.

daurnimator commented 9 years ago

What do you mean it doesn't work?

It works fine....

> L.execute('return ...', 1, 2, 3)
[1, 2, 3]

In repl:

function foo(...)
   print("foo", ...)
end
foo("testing", "varargs")
blackmiaool commented 9 years ago

Thanks for replying . Exactly , the keyword "arg" doesn't work.

daurnimator commented 9 years ago

Thanks for replying . Exactly , the keyword "arg" doesn't work.

arg is not a keyword in lua.

daurnimator commented 9 years ago

You may be reading old material related to lua 5.0? arg was a magical local variable there. That arg was removed with the release of lua 5.1 (in 2006!).

lua.vm.js currently uses lua 5.2; to be upgraded to lua 5.3 when I get the time.

blackmiaool commented 9 years ago

So that's it...thx