2022-12-19 22:11:18 +01:00
|
|
|
---Load a scaleform movie. When called from a thread, it will yield until it has loaded.
|
|
|
|
|
---@param scaleformName string
|
2024-01-17 17:38:34 +11:00
|
|
|
---@param timeout number? Approximate milliseconds to wait for the scaleform movie to load. Default is 1000.
|
2022-12-30 11:12:03 +01:00
|
|
|
---@return number? scaleform
|
2022-12-19 22:11:18 +01:00
|
|
|
function lib.requestScaleformMovie(scaleformName, timeout)
|
|
|
|
|
if type(scaleformName) ~= 'string' then
|
|
|
|
|
error(("expected scaleformName to have type 'string' (received %s)"):format(type(scaleformName)))
|
|
|
|
|
end
|
|
|
|
|
|
2022-12-30 11:12:03 +01:00
|
|
|
local scaleform = RequestScaleformMovie(scaleformName)
|
|
|
|
|
|
2023-07-31 16:06:44 +10:00
|
|
|
if not coroutine.isyieldable() then return scaleform end
|
2022-12-19 22:11:18 +01:00
|
|
|
|
2023-07-31 16:06:44 +10:00
|
|
|
return lib.waitFor(function()
|
|
|
|
|
if HasScaleformMovieLoaded(scaleform) then return scaleform end
|
2024-01-17 17:38:34 +11:00
|
|
|
end, ("failed to load scaleform '%s'"):format(scaleform), timeout)
|
2022-12-19 22:11:18 +01:00
|
|
|
end
|
|
|
|
|
|
2023-05-25 14:56:15 +10:00
|
|
|
return lib.requestScaleformMovie
|