...在lua表示可變參數, select用於獲取可變參數的值
select('#', …) --獲取可變參數的個數
select(1,...)-- 獲取第一個可變參數
範例
local function f(a,b,..)
print(select('#', …))
print(select(1, ...))
end
f(1,2,'1'.'4')
...在lua表示可變參數, select用於獲取可變參數的值
select('#', …) --獲取可變參數的個數
select(1,...)-- 獲取第一個可變參數
local function f(a,b,..)
print(select('#', …))
print(select(1, ...))
end
f(1,2,'1'.'4')
Lua 學習 元表 原表 meta table setmetatable 可以設置元表 __index (讀取), __newindex
Lua 函數 及 函數庫 函數定義: -- 函數定義 add = function ( a,b) return a + b end --局部函數
Lua 學習 閉包 先看一個現象 function count() local i = 6 -- upvalue
Unity向Lua傳入參數問題 GameObject go = GameObject.Find("/Light"); Light light = go.GetComponent<Light>(