mirror of
https://github.com/etlegacy/wolfadmin.git
synced 2024-11-10 06:41:53 +00:00
Fixed listings returning 'duplicate' rows (caused by references)
This commit is contained in:
parent
73d66589e7
commit
e993fcc89e
3 changed files with 18 additions and 6 deletions
|
@ -18,6 +18,7 @@
|
|||
local constants = require "luascripts.wolfadmin.util.constants"
|
||||
local util = require "luascripts.wolfadmin.util.util"
|
||||
local settings = require "luascripts.wolfadmin.util.settings"
|
||||
local tables = require "luascripts.wolfadmin.util.tables"
|
||||
|
||||
local stats = require "luascripts.wolfadmin.players.stats"
|
||||
|
||||
|
@ -101,7 +102,7 @@ function mysql.getaliases(playerid, limit, offset)
|
|||
local row = cur:fetch({}, "a")
|
||||
|
||||
while row do
|
||||
table.insert(aliases, row)
|
||||
table.insert(aliases, tables.copy(row))
|
||||
row = cur:fetch(row, "a")
|
||||
end
|
||||
|
||||
|
@ -161,7 +162,7 @@ function mysql.getlevels(playerid, limit, offset)
|
|||
local row = cur:fetch({}, "a")
|
||||
|
||||
while row do
|
||||
table.insert(levels, row)
|
||||
table.insert(levels, tables.copy(row))
|
||||
row = cur:fetch(row, "a")
|
||||
end
|
||||
|
||||
|
@ -198,7 +199,7 @@ function mysql.getwarns(playerid, limit, offset)
|
|||
local row = cur:fetch({}, "a")
|
||||
|
||||
while row do
|
||||
table.insert(warns, row)
|
||||
table.insert(warns, tables.copy(row))
|
||||
row = cur:fetch(row, "a")
|
||||
end
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
local constants = require "luascripts.wolfadmin.util.constants"
|
||||
local util = require "luascripts.wolfadmin.util.util"
|
||||
local settings = require "luascripts.wolfadmin.util.settings"
|
||||
local tables = require "luascripts.wolfadmin.util.tables"
|
||||
|
||||
local stats = require "luascripts.wolfadmin.players.stats"
|
||||
|
||||
|
@ -101,7 +102,7 @@ function sqlite3.getaliases(playerid, limit, offset)
|
|||
local row = cur:fetch({}, "a")
|
||||
|
||||
while row do
|
||||
table.insert(aliases, row)
|
||||
table.insert(aliases, tables.copy(row))
|
||||
row = cur:fetch(row, "a")
|
||||
end
|
||||
|
||||
|
@ -161,7 +162,7 @@ function sqlite3.getlevels(playerid, limit, offset)
|
|||
local row = cur:fetch({}, "a")
|
||||
|
||||
while row do
|
||||
table.insert(levels, row)
|
||||
table.insert(levels, tables.copy(row))
|
||||
row = cur:fetch(row, "a")
|
||||
end
|
||||
|
||||
|
@ -198,7 +199,7 @@ function sqlite3.getwarns(playerid, limit, offset)
|
|||
local row = cur:fetch({}, "a")
|
||||
|
||||
while row do
|
||||
table.insert(warns, row)
|
||||
table.insert(warns, tables.copy(row))
|
||||
row = cur:fetch(row, "a")
|
||||
end
|
||||
|
||||
|
|
|
@ -17,6 +17,16 @@
|
|||
|
||||
local tables = {}
|
||||
|
||||
function tables.copy(table)
|
||||
local copy = {}
|
||||
|
||||
for key, value in pairs(table) do
|
||||
copy[key] = value
|
||||
end
|
||||
|
||||
return copy
|
||||
end
|
||||
|
||||
function tables.unpack(table)
|
||||
if table.unpack ~= nil then
|
||||
return table.unpack(table)
|
||||
|
|
Loading…
Reference in a new issue