-
-
Notifications
You must be signed in to change notification settings - Fork 499
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
Callbacks hell, its often hard and uncomfortable to pass all data you need to next function and some of them just can't be passed
Describe the solution you'd like
add build in mta async/await style functionality, eg.:
invokeAsync(function()
response = fetchRemoteAsync("mtasa.com/api")
data = fromJSONAsync(response.data)
print(data)
dbQueryAsync("insert into...", data)
data = triggerClientEventAsync("getFoo", getRandomPlayer())
print("data", data) -- prints "foo"
while true do -- equivalent of setTimer(print, 100, 0, "hi")
sleep(100)
print("hi")
end
end)
-- clientside:
addEventHandlerAsync("getFoo", root, function()
return "foo"
end)
less code, more readable, easy to use, non blocking
Describe alternatives you've considered
/
Additional context
https://forum.mtasa.com/topic/54787-simple-sleep-function/ example how to do this
Related issues #1815
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request