Esempio n. 1
0
    static int get_Item(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes <string>(L, 1))
            {
                string arg0 = ToLua.ToString(L, 1);
                int    o    = TestExport.get_Item(arg0);
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else if (count == 1 && TypeChecker.CheckTypes <double>(L, 1))
            {
                double arg0 = (double)LuaDLL.lua_tonumber(L, 1);
                int    o    = TestExport.get_Item(arg0);
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else if (count == 2)
            {
                TestExport obj  = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));
                int        arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
                int        o    = obj[arg0];
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes <TestExport, char, int>(L, 1))
            {
                TestExport obj  = (TestExport)ToLua.ToObject(L, 1);
                char       arg0 = (char)LuaDLL.lua_tonumber(L, 2);
                int        arg1 = (int)LuaDLL.lua_tonumber(L, 3);
                int        o    = obj[arg0, arg1];
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes <int, int, int>(L, 1))
            {
                int arg0 = (int)LuaDLL.lua_tonumber(L, 1);
                int arg1 = (int)LuaDLL.lua_tonumber(L, 2);
                int arg2 = (int)LuaDLL.lua_tonumber(L, 3);
                int o    = TestExport.get_Item(arg0, arg1, arg2);
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: TestExport.get_Item"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Esempio n. 2
0
    private static int get_Item(IntPtr L)
    {
        int result;

        try
        {
            int num = LuaDLL.lua_gettop(L);
            if (num == 1 && TypeChecker.CheckTypes(L, 1, typeof(double)))
            {
                double pos = LuaDLL.lua_tonumber(L, 1);
                int    n   = TestExport.get_Item(pos);
                LuaDLL.lua_pushinteger(L, n);
                result = 1;
            }
            else if (num == 1 && TypeChecker.CheckTypes(L, 1, typeof(string)))
            {
                string pos2 = ToLua.ToString(L, 1);
                int    n2   = TestExport.get_Item(pos2);
                LuaDLL.lua_pushinteger(L, n2);
                result = 1;
            }
            else if (num == 2 && TypeChecker.CheckTypes(L, 1, typeof(TestExport), typeof(int)))
            {
                TestExport testExport = (TestExport)ToLua.ToObject(L, 1);
                int        pos3       = (int)LuaDLL.lua_tonumber(L, 2);
                int        n3         = testExport[pos3];
                LuaDLL.lua_pushinteger(L, n3);
                result = 1;
            }
            else
            {
                result = LuaDLL.luaL_throw(L, "invalid arguments to method: TestExport.get_Item");
            }
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
	static int get_Item(IntPtr L)
	{
		try
		{
			int count = LuaDLL.lua_gettop(L);

			if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(double)))
			{
				double arg0 = (double)LuaDLL.lua_tonumber(L, 1);
				int o = TestExport.get_Item(arg0);
				LuaDLL.lua_pushinteger(L, o);
				return 1;
			}
			else if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(string)))
			{
				string arg0 = ToLua.ToString(L, 1);
				int o = TestExport.get_Item(arg0);
				LuaDLL.lua_pushinteger(L, o);
				return 1;
			}
			else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(TestExport), typeof(int)))
			{
				TestExport obj = (TestExport)ToLua.ToObject(L, 1);
				int arg0 = (int)LuaDLL.lua_tonumber(L, 2);
				int o = obj[arg0];
				LuaDLL.lua_pushinteger(L, o);
				return 1;
			}
			else
			{
				return LuaDLL.luaL_throw(L, "invalid arguments to method: TestExport.get_Item");
			}
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}