コード例 #1
0
    static int AddTimer(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 3 && TypeChecker.CheckTypes <TimerUtil.CSFunc>(L, 3))
            {
                TimerUtil        obj  = (TimerUtil)ToLua.CheckObject <TimerUtil>(L, 1);
                float            arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
                TimerUtil.CSFunc arg1 = (TimerUtil.CSFunc)ToLua.ToObject(L, 3);
                int o = obj.AddTimer(arg0, arg1);
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes <LuaInterface.LuaFunction>(L, 3))
            {
                TimerUtil   obj  = (TimerUtil)ToLua.CheckObject <TimerUtil>(L, 1);
                float       arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
                LuaFunction arg1 = ToLua.ToLuaFunction(L, 3);
                int         o    = obj.AddTimer(arg0, arg1);
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: TimerUtil.AddTimer"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }