Consistent indentation and remove some files

Mixing tabs and spaces when embedding Lua can easily break MDX syntax.
This commit is contained in:
Linden committed 2022-04-29 15:39:04 +10:00
1 parent b87ef48d2e
commit 6bead3ca32
21 files changed
+146 -240

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
indent_size = 2
indent_style = space
@@ -1,24 +0,0 @@
Opens a keyboard input dialog.
The `rows` param takes a table of strings where each string entry will represent
a single row.
```lua
-- header: string
-- rows: table
exports.ox_inventory:Keyboard(header, rows)
```
Returns a table of strings where the first index is going to be the first row of the dialog,
the second index the second row and so on.
**Example:**
```lua
local input = exports.ox_inventory:Keyboard('Money transfer', {'Player name', 'Amount'})
if input then
local playerName = input[1]
local amount = tonumber(input[2])
if not playerName or not amount then return end
end
```
@@ -1,78 +0,0 @@
Starts a progress bar that can callback a function upon completion or cancellation.
Prevents actions such as opening the inventory, reloading, etc.
```lua
-- options: table
-- completed: function
exports.ox_inventory:Progress(options, completed)
```
Options table values:
```lua
-- duration: number
-- label: string
-- useWhileDead: boolean (optional)
-- canCancel: boolean (optional)
-- anim: table (optional)
-- dict: string
-- clip: string
-- flag: number (optional - default is 49)
-- scenario: string (optional)
-- prop/propTwo: table (optional)
-- model: hash or string
-- bone: number (optional - default is 60309)
-- pos: vector3 (optional)
-- rot: vector3 (optional)
-- disable: table (optional)
-- move: boolean (optional)
-- car: boolean (optional)
-- combat: boolean (optional)
-- mouse: boolean (optional)
```
:::danger
If you define a scenario while you have a defined anim table the scenario will be ignored.
:::
**Example:**
```lua
exports.ox_inventory:Progress({
duration = 2000,
label = 'Drinking water',
useWhileDead = false,
canCancel = true,
disable = {
car = true
},
anim = {
dict = 'mp_player_intdrink',
clip = 'loop_bottle',
flag = 49,
},
prop = {
model = 'prop_ld_flow_bottle',
pos = vector3(0.03, 0.03, 0.02),
rot = vector3(0.0, 0.0, -1.5),
bone = 58866
},
}, function(cancel)
if not cancel then
print("You drank some water - that'll quench ya!")
end
end)
```
### CancelProgress
Cancels the currently active progress bar.
```lua
exports.ox_inventory:CancelProgress()
```
### ProgressActive
Returns true or false whether the progress bar is currently active or not
```lua
exports.ox_inventory:ProgressActive()
```
+1 -1
View File
@@ -10,6 +10,6 @@ The following snippet can be used in crafting resources such as okokCrafting or
local itemNames = {} local itemNames = {}
for item, data in pairs(exports.ox_inventory:Items()) do for item, data in pairs(exports.ox_inventory:Items()) do
itemNames[item] = data.label itemNames[item] = data.label
end end
``` ```
+25 -25
View File
@@ -157,24 +157,24 @@ The correct formatting is `export = resourceName.exportName`.
```lua ```lua
exports('bandage', function(data, slot) exports('bandage', function(data, slot)
local playerPed = PlayerPedId() local playerPed = PlayerPedId()
local maxHealth = GetEntityMaxHealth(playerPed) local maxHealth = GetEntityMaxHealth(playerPed)
local health = GetEntityHealth(playerPed) local health = GetEntityHealth(playerPed)
-- Does the ped need to heal? -- Does the ped need to heal?
if health < maxHealth then if health < maxHealth then
-- Use the bandage -- Use the bandage
exports.ox_inventory:useItem(data, function(data) exports.ox_inventory:useItem(data, function(data)
-- The item has been used, so trigger the effects -- The item has been used, so trigger the effects
if data then if data then
SetEntityHealth(playerPed, math.min(maxHealth, math.floor(health + maxHealth / 16))) SetEntityHealth(playerPed, math.min(maxHealth, math.floor(health + maxHealth / 16)))
exports.ox_inventory:notify({text = 'You feel better already'}) exports.ox_inventory:notify({text = 'You feel better already'})
end end
end) end)
else else
-- Don't use the item -- Don't use the item
exports.ox_inventory:notify({type = 'error', text = 'You don\'t need a bandage right now'}) exports.ox_inventory:notify({type = 'error', text = 'You don\'t need a bandage right now'})
end end
end) end)
``` ```
@@ -187,23 +187,23 @@ This can either be an export (recommended), or added to [items/server.lua](https
```lua ```lua
exports('bandage', function(event, item, inventory, slot, data) exports('bandage', function(event, item, inventory, slot, data)
if event == 'usingItem' then if event == 'usingItem' then
local playerPed = GetPlayerPed(inventory.source) local playerPed = GetPlayerPed(inventory.source)
local maxHealth = GetEntityMaxHealth(playerPed) local maxHealth = GetEntityMaxHealth(playerPed)
local health = GetEntityHealth(playerPed) local health = GetEntityHealth(playerPed)
if health >= maxHealth then if health >= maxHealth then
TriggerClientEvent('ox_inventory:notify', inventory.source, {type = 'error', text = 'You don\'t need a bandage right now'}) TriggerClientEvent('ox_inventory:notify', inventory.source, {type = 'error', text = 'You don\'t need a bandage right now'})
-- Returning 'false' will prevent the item from being used -- Returning 'false' will prevent the item from being used
return false return false
end end
return return
elseif event == 'usedItem' then elseif event == 'usedItem' then
return TriggerClientEvent('ox_inventory:notify', inventory.source, {text = 'You feel better already'}) return TriggerClientEvent('ox_inventory:notify', inventory.source, {text = 'You feel better already'})
elseif event == 'buying' then elseif event == 'buying' then
return TriggerClientEvent('ox_inventory:notify', inventory.source, {type = 'success', text = 'You bought a bandage'}) return TriggerClientEvent('ox_inventory:notify', inventory.source, {type = 'success', text = 'You bought a bandage'})
end end
end) end)
``` ```
+20 -20
View File
@@ -14,8 +14,8 @@ We can set up custom stashes from outside the resource utilising the exported Re
-- weight: number -- weight: number
-- owner: string or boolean (optional) -- owner: string or boolean (optional)
-- groups: table (optional) -- groups: table (optional)
-- name: string -- name: string
-- grade: number -- grade: number
-- coords: vector or table (optional) -- coords: vector or table (optional)
``` ```
@@ -40,17 +40,17 @@ Below the value is hardset, but it could be loaded from the database (especially
```lua ```lua
-- Server -- Server
local stash = { local stash = {
id = '42wallabyway', id = '42wallabyway',
label = '42 Wallaby Way', label = '42 Wallaby Way',
slots = 50, slots = 50,
weight = 100000, weight = 100000,
owner = 'char1:license' owner = 'char1:license'
} }
AddEventHandler('onServerResourceStart', function(resourceName) AddEventHandler('onServerResourceStart', function(resourceName)
if resourceName == 'ox_inventory' or resourceName == GetCurrentResourceName() then if resourceName == 'ox_inventory' or resourceName == GetCurrentResourceName() then
exports.ox_inventory:RegisterStash(stash.id, stash.label, stash.slots, stash.weight, stash.owner) exports.ox_inventory:RegisterStash(stash.id, stash.label, stash.slots, stash.weight, stash.owner)
end end
end) end)
-- Client -- Client
@@ -63,23 +63,23 @@ The following sample is based on esx_property's db data.
local properties local properties
MySQL.query('SELECT * FROM `properties`', {}, function(result) MySQL.query('SELECT * FROM `properties`', {}, function(result)
properties = result properties = result
end end
RegisterNetEvent('ox:loadStashes', function(id) RegisterNetEvent('ox:loadStashes', function(id)
local stash = properties[id] local stash = properties[id]
if stash then if stash then
-- id: 1, name: WhispymoundDrive, label: 2677 Whispymound Drive, coords: {"x":118.748,"y":566.573,"z":175.697} -- id: 1, name: WhispymoundDrive, label: 2677 Whispymound Drive, coords: {"x":118.748,"y":566.573,"z":175.697}
ox_inventory:RegisterStash(stash.name, stash.label, 50, 100000, true, false, json.encode(stash.room_menu)) ox_inventory:RegisterStash(stash.name, stash.label, 50, 100000, true, false, json.encode(stash.room_menu))
end end
end) end)
-- Client -- Client
local ox_inventory = exports.ox_inventory local ox_inventory = exports.ox_inventory
if ox_inventory:openInventory('stash', property.id) == false then if ox_inventory:openInventory('stash', property.id) == false then
TriggerServerEvent('ox:loadStashes') TriggerServerEvent('ox:loadStashes')
ox_inventory:openInventory('stash', property.id) ox_inventory:openInventory('stash', property.id)
end end
``` ```
@@ -88,7 +88,7 @@ end
We put together an example resource showcasing how to properly utilise the stash API: We put together an example resource showcasing how to properly utilise the stash API:
<div style={{width: 'fit-content'}}> <div style={{width: 'fit-content'}}>
<a href="https://www.github.com/overextended/ox_inventory_examples"> <a href="https://www.github.com/overextended/ox_inventory_examples">
<IconButton side='left' icon={<BsGithub/>}>GitHub</IconButton> <IconButton side='left' icon={<BsGithub/>}>GitHub</IconButton>
</a> </a>
</div> </div>
+1 -5
View File
@@ -1,6 +1,6 @@
# Configuration # Configuration
You can add these settings directly to your 'server.cfg', or add them to a separate file and call it with `exec`. You can add these settings directly to your 'server.cfg', or add them to a separate file (i.e. inventory.cfg) and call it with `exec`.
:::caution :::caution
@@ -88,8 +88,4 @@ set datadog:site "datadoghq.com"
# Set server hostname # Set server hostname
set datadog:hostname "FXServer" set datadog:hostname "FXServer"
add_principal group.admin ox_inventory
add_ace resource.ox_inventory command.add_principal allow
add_ace resource.ox_inventory command.remove_principal allow
``` ```
+5 -5
View File
@@ -37,15 +37,15 @@ We provide full backwards compatibility with mysql-async and build for the curre
### Ox Lib ### Ox Lib
A resource designed to provide reusable functions that can be loaded into any resource with simple variable declarations rather than through fxmanifest. Provides easily reusable functions that can be imported into your resource or called with exports.
**Currently used for:** **Used in the inventory for**
- SetInterval - SetInterval
- Server Callbacks - Server Callbacks
- Table utilities (contains, matches)
- Requesting models, animations, etc. - Requesting models, animations, etc.
- Disabling control actions - Marker management
- Notifications and progress bar
<div style={{ width: 'fit-content' }}> <div style={{ width: 'fit-content' }}>
<a href="https://www.github.com/overextended/ox_lib"> <a href="https://www.github.com/overextended/ox_lib">
@@ -58,7 +58,7 @@ A resource designed to provide reusable functions that can be loaded into any re
### Production Build ### Production Build
The interface is written in TypeScript using the React library, so the code included in the repository will not work. The interface is written in TypeScript using the React library, so the code included in the repository will not work.
You either need to build the package yourself (more information in [guides](./Guides) section), or download a release (ox_inventory.zip). You either need to build the package yourself (more information in [guides](./Guides) section), or download a release.
<div style={{ width: 'fit-content' }}> <div style={{ width: 'fit-content' }}>
<a href="https://www.github.com/overextended/ox_inventory/releases/latest" style={{ marginRight: '0.6rem' }}> <a href="https://www.github.com/overextended/ox_inventory/releases/latest" style={{ marginRight: '0.6rem' }}>
+5 -5
View File
@@ -7,19 +7,19 @@ https://github.com/overextended/ox_lib/blob/master/resource/cache/client.lua
## States ## States
```lua ```lua
cache.ped -- player entity id cache.ped -- player entity id
cache.vehicle -- vehicle entity id cache.vehicle -- vehicle entity id
cache.seat -- vehicle seat index cache.seat -- vehicle seat index
``` ```
## lib.onCache ## lib.onCache
Register a callback function when the value is changed. Register a callback function when the value is changed.
```lua ```lua
lib.onCache('vehicle', function(value) lib.onCache('vehicle', function(value)
print('vehicle', value) print('vehicle', value)
end) end)
lib.onCache('seat', function(value) lib.onCache('seat', function(value)
print('seat', value) print('seat', value)
end) end)
``` ```
+1 -1
View File
@@ -11,7 +11,7 @@ The response is handled in a separate coroutine.
lib.callback(name, delay, cb, ...) lib.callback(name, delay, cb, ...)
lib.callback('ox_inventory:getItemCount', false, function(count) lib.callback('ox_inventory:getItemCount', false, function(count)
print(count) print(count)
end, 'water', {type = 'fresh'}) end, 'water', {type = 'fresh'})
``` ```
+8 -8
View File
@@ -9,23 +9,23 @@ Simple and centralised distance checking, supporting callbacks when entering, le
lib.points.new(coords, distance, data) lib.points.new(coords, distance, data)
local point = lib.points.new(playerCoords, 5, { local point = lib.points.new(playerCoords, 5, {
dunak = 'nerd', dunak = 'nerd',
}) })
function point:onEnter() function point:onEnter()
print('entered range of point', self.id) print('entered range of point', self.id)
end end
function point:onExit() function point:onExit()
print('left range of point', self.id) print('left range of point', self.id)
end end
function point:nearby() function point:nearby()
DrawMarker(2, self.coords.x, self.coords.y, self.coords.z, 0.0, 0.0, 0.0, 0.0, 180.0, 0.0, 1.0, 1.0, 1.0, 200, 20, 20, 50, false, true, 2, nil, nil, false) DrawMarker(2, self.coords.x, self.coords.y, self.coords.z, 0.0, 0.0, 0.0, 0.0, 180.0, 0.0, 1.0, 1.0, 1.0, 200, 20, 20, 50, false, true, 2, nil, nil, false)
if self.currentDistance < 1 and IsControlJustReleased(0, 38) then if self.currentDistance < 1 and IsControlJustReleased(0, 38) then
print('inside marker', self.id) print('inside marker', self.id)
print(self.dunak) print(self.dunak)
end end
end end
``` ```
+1 -1
View File
@@ -18,7 +18,7 @@ Requires the vehicle to belong to the client. _Do not use NetworkRequestControlO
lib.setVehicleProperties(vehicle, props) lib.setVehicleProperties(vehicle, props)
RegisterNetEvent('lualib:setVehicleProperties', function(netid, data) RegisterNetEvent('lualib:setVehicleProperties', function(netid, data)
lib.setVehicleProperties(NetToVeh(netid), data) lib.setVehicleProperties(NetToVeh(netid), data)
end) end)
``` ```
+4 -4
View File
@@ -9,9 +9,9 @@
lib.addCommand(principal, command, callback, parameters, help) lib.addCommand(principal, command, callback, parameters, help)
lib.addCommand('group.admin', {'additem', 'giveitem'}, function(source, args) lib.addCommand('group.admin', {'additem', 'giveitem'}, function(source, args)
args.item = Items(args.item) args.item = Items(args.item)
if args.item and args.count > 0 then if args.item and args.count > 0 then
Inventory.AddItem(args.target, args.item.name, args.count, args.metatype) Inventory.AddItem(args.target, args.item.name, args.count, args.metatype)
end end
end, {'target:number', 'item:string', 'count:number', 'metatype:?string'}) end, {'target:number', 'item:string', 'count:number', 'metatype:?string'})
``` ```
+2 -2
View File
@@ -7,7 +7,7 @@
lib.callback.register(name, cb) lib.callback.register(name, cb)
lib.callback.register('ox_inventory:getItemCount', function(source, item, metadata, target) lib.callback.register('ox_inventory:getItemCount', function(source, item, metadata, target)
local inventory = target and Inventory(target) or Inventory(source) local inventory = target and Inventory(target) or Inventory(source)
return (inventory and Inventory.GetItem(inventory, item, metadata, true)) or 0 return (inventory and Inventory.GetItem(inventory, item, metadata, true)) or 0
end) end)
``` ```
+17 -17
View File
@@ -14,27 +14,27 @@ Low: 0.1997ms | Avg: 0.25898800ms | Total: 2589.8800ms (10000 queries)
```lua ```lua
local val = 10000 local val = 10000
RegisterCommand('luasync', function() RegisterCommand('luasync', function()
local queryTimesLocal = {} local queryTimesLocal = {}
local result local result
MySQL.prepare.await('SELECT identifier from users WHERE lastname = ?', {'Linden'}) MySQL.prepare.await('SELECT identifier from users WHERE lastname = ?', {'Linden'})
for i=1, val do for i=1, val do
local time = os.nanotime() local time = os.nanotime()
local r = MySQL.prepare.await('SELECT identifier from users WHERE lastname = ?', {'Linden'}) local r = MySQL.prepare.await('SELECT identifier from users WHERE lastname = ?', {'Linden'})
queryTimesLocal[#queryTimesLocal+1] = (os.nanotime() - time) / 1000000 queryTimesLocal[#queryTimesLocal+1] = (os.nanotime() - time) / 1000000
if i==1 then result = r end if i==1 then result = r end
end end
local queryMsLow, queryMsSum = 1000, 0 local queryMsLow, queryMsSum = 1000, 0
for _, v in pairs(queryTimesLocal) do queryMsSum = queryMsSum + v end for _, v in pairs(queryTimesLocal) do queryMsSum = queryMsSum + v end
for _, v in pairs(queryTimesLocal) do for _, v in pairs(queryTimesLocal) do
if v < queryMsLow then queryMsLow = v end if v < queryMsLow then queryMsLow = v end
end end
local averageQueryTime = queryMsSum / #queryTimesLocal local averageQueryTime = queryMsSum / #queryTimesLocal
print(json.encode(result)) print(json.encode(result))
print('Low: '.. queryMsLow ..'ms | Avg: '..averageQueryTime..'ms | Total: '..queryMsSum..'ms ('..#queryTimesLocal..' queries)') print('Low: '.. queryMsLow ..'ms | Avg: '..averageQueryTime..'ms | Total: '..queryMsSum..'ms ('..#queryTimesLocal..' queries)')
end) end)
``` ```
+3 -3
View File
@@ -9,7 +9,7 @@ Inserts a new entry into the database and returns the insert id for the row, if
-- Alias: exports.oxmysql:insert -- Alias: exports.oxmysql:insert
-- Alias: MySQL.Async.insert -- Alias: MySQL.Async.insert
MySQL.insert('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?)', {playerIdentifier, firstName, lastName}, function(id) MySQL.insert('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?)', {playerIdentifier, firstName, lastName}, function(id)
print(id) print(id)
end) end)
``` ```
@@ -18,8 +18,8 @@ end)
-- Alias: exports.oxmysql:insert_async -- Alias: exports.oxmysql:insert_async
-- Alias: MySQL.Sync.insert -- Alias: MySQL.Sync.insert
CreateThread(function() CreateThread(function()
local id = MySQL.insert.await('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?)', {playerIdentifier, firstName, lastName}) local id = MySQL.insert.await('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?)', {playerIdentifier, firstName, lastName})
print(id) print(id)
end) end)
``` ```
+12 -12
View File
@@ -17,11 +17,11 @@ When using SELECT, the return value will match `query, single, or scalar` depend
-- Alias: MySQL.Async.prepare -- Alias: MySQL.Async.prepare
MySQL.prepare('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result) MySQL.prepare('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
if result then if result then
for _, v in pairs(result) do for _, v in pairs(result) do
print(v.identifier, v.firstname, v.lastname) print(v.identifier, v.firstname, v.lastname)
end end
end end
end) end)
``` ```
@@ -31,12 +31,12 @@ end)
-- Alias: MySQL.Sync.prepare -- Alias: MySQL.Sync.prepare
CreateThread(function() CreateThread(function()
local result = MySQL.prepare.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}) local result = MySQL.prepare.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
if result then if result then
for _, v in pairs(result) do for _, v in pairs(result) do
print(v.identifier, v.firstname, v.lastname) print(v.identifier, v.firstname, v.lastname)
end end
end end
end) end)
``` ```
@@ -48,7 +48,7 @@ exports.oxmysql.prepare('SELECT * FROM users WHERE identifier = ?', [playerIdent
if (result) { if (result) {
result.forEach((v) => { result.forEach((v) => {
console.log(v.identifier, v.firstname, v.lastname) console.log(v.identifier, v.firstname, v.lastname)
}) })
} }
}) })
``` ```
+12 -12
View File
@@ -10,11 +10,11 @@ When selecting data it will return all matching rows and columns, otherwise it w
-- Alias: MySQL.Async.query -- Alias: MySQL.Async.query
MySQL.query('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result) MySQL.query('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
if result then if result then
for _, v in pairs(result) do for _, v in pairs(result) do
print(v.identifier, v.firstname, v.lastname) print(v.identifier, v.firstname, v.lastname)
end end
end end
end) end)
``` ```
### Promise ### Promise
@@ -23,12 +23,12 @@ end)
-- Alias: MySQL.Sync.query -- Alias: MySQL.Sync.query
CreateThread(function() CreateThread(function()
local result = MySQL.query.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}) local result = MySQL.query.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
if result then if result then
for _, v in pairs(result) do for _, v in pairs(result) do
print(v.identifier, v.firstname, v.lastname) print(v.identifier, v.firstname, v.lastname)
end end
end end
end) end)
``` ```
@@ -40,7 +40,7 @@ exports.oxmysql.query('SELECT * FROM users WHERE identifier = ?', [playerIdentif
if (result) { if (result) {
result.forEach((v) => { result.forEach((v) => {
console.log(v.identifier, v.firstname, v.lastname) console.log(v.identifier, v.firstname, v.lastname)
}) })
} }
}) })
``` ```
+3 -3
View File
@@ -9,7 +9,7 @@ Returns the first column for a single row.
-- Alias: MySQL.Async.fetchScalar -- Alias: MySQL.Async.fetchScalar
MySQL.scalar('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier}, function(firstname) MySQL.scalar('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier}, function(firstname)
print(firstname) print(firstname)
end) end)
``` ```
@@ -19,8 +19,8 @@ end)
-- Alias: MySQL.Sync.fetchScalar -- Alias: MySQL.Sync.fetchScalar
CreateThread(function() CreateThread(function()
local firstname = MySQL.scalar.await('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier}) local firstname = MySQL.scalar.await('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier})
print(firstname) print(firstname)
end) end)
``` ```
+7 -7
View File
@@ -9,9 +9,9 @@ Returns the columns for a single row.
-- Alias: MySQL.Async.fetchSingle -- Alias: MySQL.Async.fetchSingle
MySQL.single('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result) MySQL.single('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
if result then if result then
print(result.identifier, result.firstname, result.lastname) print(result.identifier, result.firstname, result.lastname)
end end
end) end)
``` ```
@@ -21,10 +21,10 @@ end)
-- Alias: MySQL.Sync.fetchSingle -- Alias: MySQL.Sync.fetchSingle
CreateThread(function() CreateThread(function()
local result = MySQL.single.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}) local result = MySQL.single.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
if result then if result then
print(result.identifier, result.firstname, result.lastname) print(result.identifier, result.firstname, result.lastname)
end end
end) end)
``` ```
+7 -7
View File
@@ -9,9 +9,9 @@ Returns the number of affected rows by the query.
-- Alias: MySQL.Async.execute -- Alias: MySQL.Async.execute
MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ?', {newName, playerIdentifier}, function(affectedRows) MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ?', {newName, playerIdentifier}, function(affectedRows)
if affectedRows then if affectedRows then
print(affectedRows) print(affectedRows)
end end
end) end)
``` ```
@@ -21,10 +21,10 @@ end)
-- Alias: MySQL.Sync.execute -- Alias: MySQL.Sync.execute
CreateThread(function() CreateThread(function()
local affectedRows = MySQL.update.await('UPDATE users SET firstname = ? WHERE identifier = ?', {newName, playerIdentifier}) local affectedRows = MySQL.update.await('UPDATE users SET firstname = ? WHERE identifier = ?', {newName, playerIdentifier})
if affectedRows then if affectedRows then
print(affectedRows) print(affectedRows)
end end
end) end)
``` ```