restructure ox_lib docs

This commit is contained in:
Linden committed 2022-05-12 18:07:54 +10:00
1 parent 8081132d6f
commit a8be760943
21 files changed
+5 -30

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
Triggers a registered server callback and registers an event handler for the response.
### lib.callback
The response is handled in a separate coroutine.
```lua
-- name: string
-- delay: number or false
-- cb: function
lib.callback(name, delay, cb, ...)
lib.callback('ox_inventory:getItemCount', false, function(count)
print(count)
end, 'water', {type = 'fresh'})
```
### lib.callback.await
The current coroutine is yielded until a response is received.
```lua
-- name: string
-- delay: number or false
lib.callback.await(name, delay, ...)
local count = lib.callback.await('ox_inventory:getItemCount', false, 'water', {type = 'fresh'})
print(count)
```