Scripts/resources/[standalone]/ox_lib/imports/requestAnimDict/client.lua

20 lines
766 B
Lua
Raw Normal View History

2024-12-29 20:02:43 +00:00
---Load an animation dictionary. When called from a thread, it will yield until it has loaded.
---@param animDict string
2024-12-30 10:15:34 +00:00
---@param timeout number? Approximate milliseconds to wait for the dictionary to load. Default is 10000.
---@return string animDict
2024-12-29 20:02:43 +00:00
function lib.requestAnimDict(animDict, timeout)
if HasAnimDictLoaded(animDict) then return animDict end
if type(animDict) ~= 'string' then
error(("expected animDict to have type 'string' (received %s)"):format(type(animDict)))
end
if not DoesAnimDictExist(animDict) then
2024-12-30 10:15:34 +00:00
error(("attempted to load invalid animDict '%s'"):format(animDict))
2024-12-29 20:02:43 +00:00
end
2024-12-30 10:15:34 +00:00
return lib.streamingRequest(RequestAnimDict, HasAnimDictLoaded, 'animDict', animDict, timeout)
2024-12-29 20:02:43 +00:00
end
return lib.requestAnimDict