mirror of
https://github.com/etlegacy/wolfadmin.git
synced 2024-11-21 20:01:18 +00:00
Fixed listings returning 'duplicate' rows (caused by references)
This commit is contained in:
parent
4253955dbb
commit
c73a41f7e7
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"
|
||||
|
||||
|
@ -83,7 +84,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
|
||||
|
||||
|
@ -143,7 +144,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
|
||||
|
||||
|
@ -180,7 +181,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"
|
||||
|
||||
|
@ -83,7 +84,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
|
||||
|
||||
|
@ -143,7 +144,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
|
||||
|
||||
|
@ -180,7 +181,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.contains(table, needle)
|
||||
for key, value in pairs(table) do
|
||||
if value == needle then
|
||||
|
|
Loading…
Reference in a new issue