在Lua函数中,如何使用(…)版本作为参数传递?

2026-06-05 09:085阅读0评论SEO资源
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计148个文字,预计阅读时间需要1分钟。

在Lua函数中,如何使用(…)版本作为参数传递?

这是我能想到的最简单的例子:luafunction NewPrint(...) print(printed:, ...)end

NewPrint(Hi)

在Lua函数中,如何使用(…)版本作为参数传递?

这是我能想象到的最简单的例子:

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

请注意,我实际上没有做过Lua一段时间,我可能错过了一些语法.

按照 Lua.org documentation,它是Lua 5.1.

Lua 5.1 was released on 21 Feb 2006. Its main new features were a new module system, incremental garbage collection, new mechanism for varargs, new syntax for long strings and comments, mod and length operators, metatables for all types, new configuration scheme via luaconf.h, and a fully reentrant parser.

本文共计148个文字,预计阅读时间需要1分钟。

在Lua函数中,如何使用(…)版本作为参数传递?

这是我能想到的最简单的例子:luafunction NewPrint(...) print(printed:, ...)end

NewPrint(Hi)

在Lua函数中,如何使用(…)版本作为参数传递?

这是我能想象到的最简单的例子:

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

请注意,我实际上没有做过Lua一段时间,我可能错过了一些语法.

按照 Lua.org documentation,它是Lua 5.1.

Lua 5.1 was released on 21 Feb 2006. Its main new features were a new module system, incremental garbage collection, new mechanism for varargs, new syntax for long strings and comments, mod and length operators, metatables for all types, new configuration scheme via luaconf.h, and a fully reentrant parser.