In which version was introduced (...) in Lua functions as arguments?

This is the simplest example I can imagine:

function NewPrint(...) print("printed:", ...) end NewPrint("Hi") 

Please note that I haven't actually been running Lua for a while, maybe I missed some syntax.

+4
source share
2 answers

According to the Lua.org documentation , it was Lua 5.1.

Lua 5.1 was released on February 21, 2006. Its main new features were a new modular system, incremental garbage collection, a new mechanism for varargs , a new syntax for long lines and comments, mod and length statements, metatables for all types, a new configuration scheme through luaconf.h and a fully reentrant parser.

+5
source

The function definition syntax was introduced in Lua 5.0 ( manual ) Lua 2.5 (thanks to Louis for correcting me), but to use these varargs, you had to use the arg table. This was fixed in Lua 5.1, which allowed the use of the notation ... for definitions and access to varargs.

+2
source

Source: https://habr.com/ru/post/1486903/


All Articles