예제 #1
0
    private static int TranslateAudio(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 3);
            PlatformUtil    platformUtil = (PlatformUtil)ToLua.CheckObject(L, 1, typeof(PlatformUtil));
            string          audioFile    = ToLua.CheckString(L, 2);
            LuaTypes        luaTypes     = LuaDLL.lua_type(L, 3);
            Action <string> completeCallback;
            if (luaTypes != LuaTypes.LUA_TFUNCTION)
            {
                completeCallback = (Action <string>)ToLua.CheckObject(L, 3, typeof(Action <string>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 3);
                completeCallback = (DelegateFactory.CreateDelegate(typeof(Action <string>), func) as Action <string>);
            }
            platformUtil.TranslateAudio(audioFile, completeCallback);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }