mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-01 22:21:51 +00:00
Wrap Sync exports in CreateThread/setImmediate
This commit is contained in:
1 parent
9af6205bb7
commit
2c2f4e0661
5 files changed
+59
-39
No files matched your search
+11
-7
@@ -15,10 +15,12 @@ Inserts a new entry into the database and returns the insert id for the row, if
|
||||
```
|
||||
**Sync**
|
||||
```lua
|
||||
local id = exports.oxmysql:insertSync('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?) ', {playerIdentifier, firstName, lastName})
|
||||
if id then
|
||||
print(id)
|
||||
end
|
||||
CreateThread(function()
|
||||
local id = exports.oxmysql:insertSync('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?) ', {playerIdentifier, firstName, lastName})
|
||||
if id then
|
||||
print(id)
|
||||
end
|
||||
end)
|
||||
```
|
||||
=== "JavaScript"
|
||||
**Async**
|
||||
@@ -30,7 +32,9 @@ Inserts a new entry into the database and returns the insert id for the row, if
|
||||
```
|
||||
**Sync**
|
||||
```js
|
||||
const id = exports.oxmysql.insertSync('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?) ', [playerIdentifier, firstName, lastName]) {
|
||||
if (id)
|
||||
console.log(id)
|
||||
setImmediate(async () => {
|
||||
const id = exports.oxmysql.insertSync('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?) ', [playerIdentifier, firstName, lastName]) {
|
||||
if (id)
|
||||
console.log(id)
|
||||
})
|
||||
```
|
||||
Reference in new issue
Block a user