lua: command_native_async: make the callback optional

The documentation states that the callback is optional, but it actually
was not.

Now it's optional, as docuented.
This commit is contained in:
CogentRedTester 2022-06-22 21:09:49 +09:30 committed by Avi Halachmi (:avih)
parent 099ae86717
commit 1ffdb9128d
1 changed files with 1 additions and 0 deletions

View File

@ -615,6 +615,7 @@ local async_next_id = 1
function mp.command_native_async(node, cb)
local id = async_next_id
async_next_id = async_next_id + 1
cb = cb or function() end
local res, err = mp.raw_command_native_async(id, node)
if not res then
mp.add_timeout(0, function() cb(false, nil, err) end)