Skip to content

Commit

Permalink
fix(requestScaleformMovie): use scaleform handle (#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
antond15 authored Apr 11, 2024
1 parent 5c9c79a commit 761b52a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions imports/requestScaleformMovie/client.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
---Load a scaleform movie. When called from a thread, it will yield until it has loaded.
---@param scaleformName string
---@param timeout number? Approximate milliseconds to wait for the scaleform movie to load. Default is 1000.
---@return number scaleform
---@return number? scaleform
function lib.requestScaleformMovie(scaleformName, timeout)
if type(scaleformName) ~= 'string' then
error(("expected scaleformName to have type 'string' (received %s)"):format(type(scaleformName)))
end

return lib.streamingRequest(RequestScaleformMovie, HasScaleformMovieLoaded, 'scaleformMovie', scaleformName, timeout)
local scaleform = RequestScaleformMovie(scaleformName)

return lib.waitFor(function()
if HasScaleformMovieLoaded(scaleform) then return scaleform end
end, ("failed to load scaleformMovie '%s'"):format(scaleformName), timeout)
end

return lib.requestScaleformMovie

0 comments on commit 761b52a

Please sign in to comment.