-
-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(requestScaleformMovie): use scaleform handle (#543)
- Loading branch information
Showing
1 changed file
with
6 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |