generic T support - sonygod/luaxe-nlua GitHub Wiki
from Test.lua ,I found a way to support generic in lua .
TestClassWithGenericMethod classWithGenericMethod = new TestClassWithGenericMethod ();
////////////////////////////////////////////////////////////////////////////
/// ////////////////////////////////////////////////////////////////////////
/// IMPORTANT: Use generic method with the type you will call or generic methods will fail with iOS
/// ////////////////////////////////////////////////////////////////////////
classWithGenericMethod.GenericMethod<double>(99.0);
classWithGenericMethod.GenericMethod<TestClass>(new TestClass (99));
////////////////////////////////////////////////////////////////////////////
/// ////////////////////////////////////////////////////////////////////////
lua.RegisterFunction ("genericMethod2", classWithGenericMethod, typeof(TestClassWithGenericMethod).GetMethod ("GenericMethod"));
IMPORTANT: Use generic method with the type you will call or generic methods will fail with iOS
off course ,we support in haxe
var aa :DfList<GameObject> = untyped (__lua__("newList(self.current.gameObject)"));
trace(current.gameObject);
aa.Add(current.gameObject);
trace(aa.Count);
c# :
var csHelper= new CsHelper();
env.RegisterFunction("newList", csHelper, typeof (CsHelper).GetMethod("newDFList"));
public class CsHelper
{
public dfList<T> newDFList<T>(T value)
{
return new dfList<T>();
}
}