2025-03-18 18:46:09 +11:00
|
|
|
--[[
|
|
|
|
|
https://github.com/overextended/ox_lib
|
|
|
|
|
|
|
|
|
|
This file is licensed under LGPL-3.0 or higher <https://www.gnu.org/licenses/lgpl-3.0.en.html>
|
|
|
|
|
|
2025-03-29 21:44:03 +11:00
|
|
|
Copyright © 2025 Linden <https://github.com/thelindat>
|
2025-03-18 18:46:09 +11:00
|
|
|
]]
|
|
|
|
|
|
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.
|
2024-04-11 03:22:41 +02: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
|
|
|
|
|
|
2024-04-11 03:22:41 +02:00
|
|
|
local scaleform = RequestScaleformMovie(scaleformName)
|
|
|
|
|
|
|
|
|
|
return lib.waitFor(function()
|
|
|
|
|
if HasScaleformMovieLoaded(scaleform) then return scaleform end
|
|
|
|
|
end, ("failed to load scaleformMovie '%s'"):format(scaleformName), timeout)
|
2022-12-19 22:11:18 +01:00
|
|
|
end
|
|
|
|
|
|
2023-05-25 14:56:15 +10:00
|
|
|
return lib.requestScaleformMovie
|