Beispiel #1
0
	static int ULong(IntPtr L)
	{
		try
		{
			int count = LuaDLL.lua_gettop(L);

			if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(LuaInterface.LuaInteger64)))
			{
				LuaInteger64 arg0 = LuaDLL.tolua_toint64(L, 1);
				ulong o = Util.ULong(arg0);
				LuaDLL.lua_pushnumber(L, o);
				return 1;
			}
			else if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(cs.MyUint64)))
			{
				cs.MyUint64 arg0 = (cs.MyUint64)ToLua.ToObject(L, 1);
				ulong o = Util.ULong(arg0);
				LuaDLL.lua_pushnumber(L, o);
				return 1;
			}
			else
			{
				return LuaDLL.luaL_throw(L, "invalid arguments to method: Util.ULong");
			}
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
Beispiel #2
0
	void Start () 
    {
		#if UNITY_5		
		Application.logMessageReceived += ShowTips;
		#else
		Application.RegisterLogCallback(ShowTips);           
		#endif
		new LuaResLoader();
        LuaState lua = new LuaState();
        lua.Start();
        lua.DoString(script);				                   

        LuaFunction func = lua.GetFunction("TestInt64");
        func.BeginPCall();
		func.PushInt64(9223372036854775807 - 789);
        func.PCall();
        LuaInteger64 n64 = func.CheckInteger64();
        Debugger.Log("int64 return from lua is: {0}", n64);
        func.EndPCall();
        func.Dispose();
        func = null;

        lua.CheckTop();    
		lua.Dispose();  
		lua = null;
	}	
Beispiel #3
0
    public static LuaInteger64 Uint64(string value)
    {
        ulong        longValue = ulong.Parse(value);
        LuaInteger64 myUnit64  = new LuaInteger64((long)longValue);

        return(myUnit64);
    }
Beispiel #4
0
    void Start()
    {
        LuaState lua = new LuaState();

        lua.Start();
        lua.DoString(script);

        long   x    = 123456789123456789;
        double low  = (double)(x & 0xFFFFFFFF);
        double high = (double)(x >> 32);

        Debugger.Log("number x low is {0}, high is {1}", low, high);

        LuaFunction func = lua.GetFunction("TestInt64");

        func.BeginPCall();
        func.PushInt64(123456789123456000);
        func.PCall();
        LuaInteger64 n64 = func.CheckInteger64();

        Debugger.Log("int64 return from lua is: {0}", n64);
        func.EndPCall();
        func.Dispose();
        func = null;

        lua.CheckTop();
        lua.Dispose();
    }
Beispiel #5
0
 public void writeUint64(LuaInteger64 v)
 {
     byte[] getdata = BitConverter.GetBytes(v);
     for (int i = 0; i < getdata.Length; i++)
     {
         datas_[wpos++] = getdata[i];
     }
 }
Beispiel #6
0
    public static MyUint64 Uint64(LuaInteger64 uint64Helper)
    {
        MyUint64 myUnit64  = new MyUint64();
        ulong    longValue = uint64Helper.ToUInt64();
        uint     high      = (uint)(longValue >> 32);
        uint     low       = (uint)(longValue - ((ulong)(high) << 32));

        myUnit64.High = high;
        myUnit64.Low  = low;
        return(myUnit64);
    }
 static public void CallParaLuaFunc(LuaFunction luaFunc, uint para1, LuaInteger64 para2, LuaInteger64 para3)
 {
     if (luaFunc != null)
     {
         luaFunc.BeginPCall();
         luaFunc.Push(para1);
         luaFunc.PushInt64(para2);
         luaFunc.PushInt64(para3);
         luaFunc.PCall();
         luaFunc.EndPCall();
     }
 }
Beispiel #8
0
	static int ULongTostring(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 1);
			LuaInteger64 arg0 = ToLua.CheckLuaInteger64(L, 1);
			string o = Util.ULongTostring(arg0);
			LuaDLL.lua_pushstring(L, o);
			return 1;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
Beispiel #9
0
	static int Uint64(IntPtr L)
	{
		try
		{
			int count = LuaDLL.lua_gettop(L);

			if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(LuaInterface.LuaInteger64)))
			{
				LuaInteger64 arg0 = LuaDLL.tolua_toint64(L, 1);
				cs.MyUint64 o = Util.Uint64(arg0);
				ToLua.PushObject(L, o);
				return 1;
			}
			else if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(string)))
			{
				string arg0 = ToLua.ToString(L, 1);
				LuaInterface.LuaInteger64 o = Util.Uint64(arg0);
				LuaDLL.tolua_pushint64(L, o);
				return 1;
			}
			else if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(ulong)))
			{
				ulong arg0 = (ulong)LuaDLL.lua_tonumber(L, 1);
				cs.MyUint64 o = Util.Uint64(arg0);
				ToLua.PushObject(L, o);
				return 1;
			}
			else
			{
				return LuaDLL.luaL_throw(L, "invalid arguments to method: Util.Uint64");
			}
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
Beispiel #10
0
 public void PushInt64(LuaInteger64 n64)
 {
     luaState.PushInt64(n64);
     ++argCount;
 }
Beispiel #11
0
    public static LuaInteger64 ToUint64Helper(ulong longValue)
    {
        LuaInteger64 uint64Helper = new LuaInteger64((long)longValue);

        return(uint64Helper);
    }
Beispiel #12
0
 public static string ULongTostring(LuaInteger64 uint64Helper)
 {
     return(uint64Helper.ToUInt64().ToString());
 }
Beispiel #13
0
 public static ulong ULong(LuaInteger64 uint64Helper)
 {
     return(uint64Helper.ToUInt64());
 }