-- Closure implements iterator
function Values(t)
local i=0
return function ()
i=i+1
return t[i]
end
end
--Connect C# to use
--Create an empty object
--Every time you call Unity, you must prefix CS.UnityEngine
a=CS.UnityEngine
--[[Create an empty object
a.GameObject("lua")
]]
--[[Find The camera can be searched by name and tag
camera=a.GameObject.FindWithTag('MainCamera')
if camera~=nil then
print("find")
else
print("not find")
end
]]
--[[Clone an object
qiu=a.Resources.Load('qiu')
a.GameObject.Instantiate(qiu)
]]
--[[Calling C# properties and methods lua does not recognize static methods cannot call
lua=CS.txt()
print(lua.id)
lua:Get()
]]
--[[Access enumeration value
print(CS.State.Run)
--print(CS.State.R__CastFrom(1))
]]
--[[Get input box and button primary key
function Init()
btn=a.GameObject.Find("an"):GetComponent(typeof(a.UI.Button))
UserName=a.GameObject.Find("srk") :GetComponent(typeof(a.UI.InputField))
--btn.onClick:AddListener(Click)
btn.onClick:AddListener--equivalent to comment
(
function()
print(UserName.text)
end
)
end
--function Click()
--print(UserName. text)
--end
]]