public static string FirstPushEnumFunc(int i) { string luaScript = @" function first_push(t,obj) if t==1 then if obj == CS.FirstPushEnum.E1 then return 1 else return 2 end elseif t==2 then if obj == CS.FirstPushEnum.self then return 3 else return 4 end else return 5 end end"; luaEnv.DoString(luaScript); LuaFunction f1 = luaEnv.Global.Get <LuaFunction>("first_push"); LuaTestCommon.Log("LuaFunction<" + f1); object[] ret = f1.Call(i, FirstPushEnum.E1); return(ret[0].ToString()); }
public void SetStruct(GenCodeStruct var, out int add, out NoGenCodeStruct value) { struct_var.Byte = var.Byte; struct_var.Char = var.Char; struct_var.Decimal = var.Decimal; struct_var.Double = var.Double; struct_var.Float = var.Float; struct_var.IntVar1 = var.IntVar1; struct_var.IntVar2 = var.IntVar2; struct_var.Long = var.Long; struct_var.ULong = var.ULong; struct_var.Short = var.Short; struct_var.String = var.String; struct_var.UInt = var.UInt; struct_var.UShort = var.UShort; struct_var.IncludeStruct = new ConStruct(var.IncludeStruct.x, var.IncludeStruct.y, var.IncludeStruct.z); add = struct_var.Add(var.IntVar1, var.IntVar2); value = struct_var; LuaTestCommon.Log("NoGenCodeStruct Byte:" + struct_var.Byte); LuaTestCommon.Log("NoGenCodeStruct Char:" + struct_var.Char); LuaTestCommon.Log("NoGenCodeStruct Decimal:" + struct_var.Decimal); LuaTestCommon.Log("NoGenCodeStruct Double:" + struct_var.Double); LuaTestCommon.Log("NoGenCodeStruct Float:" + struct_var.Float); LuaTestCommon.Log("NoGenCodeStruct IntVar1:" + struct_var.IntVar1); LuaTestCommon.Log("NoGenCodeStruct IntVar2:" + struct_var.IntVar2); LuaTestCommon.Log("NoGenCodeStruct Long:" + struct_var.Long); LuaTestCommon.Log("NoGenCodeStruct ULong:" + struct_var.ULong); LuaTestCommon.Log("NoGenCodeStruct Short:" + struct_var.Short); LuaTestCommon.Log("NoGenCodeStruct String:" + struct_var.String); LuaTestCommon.Log("NoGenCodeStruct UInt:" + struct_var.UInt); LuaTestCommon.Log("NoGenCodeStruct UShort:" + struct_var.UShort); LuaTestCommon.Log("NoGenCodeStruct IncludeStruct.x:" + struct_var.IncludeStruct.x + ", IncludeStruct.y:" + struct_var.IncludeStruct.y + ", IncludeStruct.z:" + struct_var.IncludeStruct.z); }
public void Sub(HasConstructStruct invar, ref HasConstructStruct refvar, out HasConstructStruct outvar) { outvar = invar; outvar.x = invar.x - refvar.x; refvar.x = invar.x; LuaTestCommon.Log("refvar.x:" + refvar.x + ",refvar.y:" + refvar.y + ", refvar.z:" + refvar.z); }
public byte PrintPtr(IntPtr p) { LuaTestCommon.Log("p == ptr?" + (p == ptr)); byte[] abc = new byte[] { 0, 0, 0 }; System.Runtime.InteropServices.Marshal.Copy(p, abc, 0, abc.Length); LuaTestCommon.Log(string.Format("{0},{1},{2}", abc[0], abc[1], abc[2])); return(abc[0]); }
public static void Sub(this Employeestruct i, Employeestruct d, out Employeestruct e, ref Employeestruct a) { e = d; e.Salary = 10000; a.Salary = i.Salary - d.Salary; LuaTestCommon.Log("e.name:" + e.Name + ", e.salary:" + e.Salary); LuaTestCommon.Log("a.name:" + a.Name + ", a.salary:" + a.Salary); }
public static NoGenCodeStruct GetStaticVar() { LuaTestCommon.Log("static struct byte:" + struct_var1.Byte); return(struct_var1); }
public void GenericMethod <T>() { LuaTestCommon.Log("GenericMethod<" + typeof(T) + ">"); }
public static void PrintAllString(this TestChineseString i) { LuaTestCommon.Log("GetLongChineString:" + i.GetLongChineString()); }
public static void PrintSalary(this Employeestruct i) { LuaTestCommon.Log("Salary:" + i.Salary); }
public AClass(int x, int y, string z) : base(x, y, z) { LuaTestCommon.Log("AClass Constructor"); }