mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-16 22:37:34 +00:00
refactor: pairs -> ipairs
This commit is contained in:
parent
8351468779
commit
80d5a9942c
|
@ -201,7 +201,7 @@ function gmInte.openConfigMenu(data)
|
||||||
messageLabel:Dock(FILL)
|
messageLabel:Dock(FILL)
|
||||||
messageLabel:SetText("Here you can configure your server settings.\nServer ID and Token are available on the webpanel in the server settings.\nThe documentation is available at https://docs.gmod-integration.com/\nIf you need help, please contact us on our discord server.")
|
messageLabel:SetText("Here you can configure your server settings.\nServer ID and Token are available on the webpanel in the server settings.\nThe documentation is available at https://docs.gmod-integration.com/\nIf you need help, please contact us on our discord server.")
|
||||||
messageLabel:SetWrap(true)
|
messageLabel:SetWrap(true)
|
||||||
for k, catName in pairs(configCat) do
|
for k, catName in ipairs(configCat) do
|
||||||
local collapsibleCategory = vgui.Create("DCollapsibleCategory", scrollPanel)
|
local collapsibleCategory = vgui.Create("DCollapsibleCategory", scrollPanel)
|
||||||
collapsibleCategory:Dock(TOP)
|
collapsibleCategory:Dock(TOP)
|
||||||
collapsibleCategory:DockMargin(10, 0, 10, 10)
|
collapsibleCategory:DockMargin(10, 0, 10, 10)
|
||||||
|
@ -221,7 +221,7 @@ function gmInte.openConfigMenu(data)
|
||||||
|
|
||||||
// Sort by position
|
// Sort by position
|
||||||
table.sort(categoryConfig, function(a, b) return (a.position || 0) < (b.position || 0) end)
|
table.sort(categoryConfig, function(a, b) return (a.position || 0) < (b.position || 0) end)
|
||||||
for k, actualConfig in pairs(categoryConfig) do
|
for k, actualConfig in ipairs(categoryConfig) do
|
||||||
local panel = vgui.Create("DPanel", configList)
|
local panel = vgui.Create("DPanel", configList)
|
||||||
panel:Dock(TOP)
|
panel:Dock(TOP)
|
||||||
panel:SetSize(300, 25)
|
panel:SetSize(300, 25)
|
||||||
|
@ -285,7 +285,7 @@ function gmInte.openConfigMenu(data)
|
||||||
buttonGrid:SetColWide(frame:GetWide() / 2 - 5)
|
buttonGrid:SetColWide(frame:GetWide() / 2 - 5)
|
||||||
buttonGrid:SetRowHeight(45)
|
buttonGrid:SetRowHeight(45)
|
||||||
local buttonsCount = 0
|
local buttonsCount = 0
|
||||||
for k, v in pairs(buttonsInfo) do
|
for k, v in ipairs(buttonsInfo) do
|
||||||
if v.condition && !v.condition(data) then continue end
|
if v.condition && !v.condition(data) then continue end
|
||||||
local button = vgui.Create("DButton")
|
local button = vgui.Create("DButton")
|
||||||
button:SetText(v.label)
|
button:SetText(v.label)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
function gmInte.chatAddText(data)
|
function gmInte.chatAddText(data)
|
||||||
local args = {}
|
local args = {}
|
||||||
for _, v in pairs(data) do
|
for _, v in ipairs(data) do
|
||||||
table.insert(args, v.color)
|
table.insert(args, v.color)
|
||||||
table.insert(args, v.text)
|
table.insert(args, v.text)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
local function websocketDLLExist()
|
local function websocketDLLExist()
|
||||||
local files, _ = file.Find("lua/bin/*", "GAME")
|
local files, _ = file.Find("lua/bin/*", "GAME")
|
||||||
for k, v in pairs(files) do
|
for k, v in ipairs(files) do
|
||||||
if v:find("gwsockets") then return true end
|
if v:find("gwsockets") then return true end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -12,7 +12,7 @@ local function filterMessage(reason)
|
||||||
"Service provided by Gmod Integration",
|
"Service provided by Gmod Integration",
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v in pairs(Message) do
|
for k, v in ipairs(Message) do
|
||||||
Message[k] = "\n" .. v
|
Message[k] = "\n" .. v
|
||||||
end
|
end
|
||||||
return table.concat(Message)
|
return table.concat(Message)
|
||||||
|
|
|
@ -39,7 +39,7 @@ if AWarn then
|
||||||
AWarn3_MySQLite.query(query, function(result)
|
AWarn3_MySQLite.query(query, function(result)
|
||||||
if !result then return end
|
if !result then return end
|
||||||
local warns = {}
|
local warns = {}
|
||||||
for k, v in pairs(result) do
|
for k, v in ipairs(result) do
|
||||||
table.insert(warns, {
|
table.insert(warns, {
|
||||||
playerSteamID64 = v.PlayerID,
|
playerSteamID64 = v.PlayerID,
|
||||||
adminSteamID64 = v.AdminID,
|
adminSteamID64 = v.AdminID,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user