feat(resource/streaming): set timeout length and return requested item on success#4
Merged
thelindat merged 3 commits intooverextended:masterfrom Dec 12, 2021
DokaDoka:patch-2
Merged
feat(resource/streaming): set timeout length and return requested item on success#4thelindat merged 3 commits intooverextended:masterfrom DokaDoka:patch-2
thelindat merged 3 commits intooverextended:masterfrom
DokaDoka:patch-2
Conversation
Member
|
Maybe something like this would be a bit nicer (I'll let you test it, don't want to load up FiveM atm). local function hasLoaded(fn, type, request, timeout)
timeout = timeout or 100
while not fn(request) do
Wait(0)
timeout -= 0
if timeout < 1 then
return print(('Unable to load %s after %s ticks (%s)'):format(type, timeout, request))
end
end
return name
end |
Collaborator
Author
|
100 ticks as the default is fine by me, will still need use a separate variable for timeout or it will always print 0 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a bit of a mess since I've had it sitting around for about a month and I don't know how to split it up nicely at this point.
It's basically 2 parts:
adds the timeout parameter
allows the number of ticks before timeout to be specified, timeout is avoided if
nil20 ticks was rarely enough for vehicle spawns
returns the requested item on success
basically just to return the vehicle hash so I don't have to
joaatit twiceadded to the other functions for consistency
I haven't tested the functions aside from
requestAnimDictandrequestModelbut everything should still function