没什么说的直接上代码
using UnityEngine;
using System.Collections;
using LuaInterface;
using System.Collections.Generic;
using System;
//需要导出委托类型如下:
//System.Predicate<int>
//System.Action<int>
//System.Comparison<int>
public class UseList : LuaClient
{
private string script =
@"
function Exist2(v)
return v == 2
end
function IsEven(v)
return v % 2 == 0
end
function NotExist(v)
return false
end
function Compare(a, b)
if a > b then
return 1
elseif a == b then
return 0
else
return -1
end
end
function Test(list, list1)
list:Add(123) --Add
print('Add result: list[0] is '..list[0]) --下标
list:AddRange(list1) AddRange(IEnumerable<T> collection)
print(string.format('AddRange result: list[1] is %d, list[2] is %d', list[1], list[2]))
local const = list:AsReadOnly() --c# public ReadOnlyCollection<T>