mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-01 14:38:50 +00:00
Basic docs for all of ox_lib
This commit is contained in:
1 parent
2350a5bfc1
commit
fd5ccc4964
14 files changed
+206
-64
No files matched your search
@@ -0,0 +1,27 @@
|
||||
# Callbacks
|
||||
|
||||
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('ox_inventory:getItemCount', false, 'water', {type = 'fresh'})
|
||||
print(count)
|
||||
```
|
||||
Reference in new issue
Block a user