string pack ( string $format [, mixed $args [, mixed $... ]] ) Pack given arguments into a binary string according to format. The idea for this function was taken from Perl and all formatting codes work the same as in Perl. However, there are some fo
一.简介 Lua的变长参数和unpack函数在实际的开发中应用的还挺多的,比如在设计print函数的时候,需要支持对多个变量进行打印输出,这时我们就需要用到Lua中的变长参数和unpack函数了. 二.Lua变长参数与unpack函数 Lua中支持可变参数,用 ... 表示.比如定义下面的这样一个函数: local function func1(...) end 当然它也支持在变长参数前面添加固定参数: local function func1(var,...) --dosomething en