mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 22:07:34 +00:00
fix: pairs -> ipairs
This commit is contained in:
parent
c499705d5a
commit
bcbcd03323
|
@ -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)
|
||||||
|
@ -215,13 +215,13 @@ function gmInte.openConfigMenu(data)
|
||||||
configList:EnableVerticalScrollbar(false)
|
configList:EnableVerticalScrollbar(false)
|
||||||
collapsibleCategory:SetContents(configList)
|
collapsibleCategory:SetContents(configList)
|
||||||
local categoryConfig = {}
|
local categoryConfig = {}
|
||||||
for k, v in pairs(possibleConfig) do
|
for k, v in ipairs(possibleConfig) do
|
||||||
if v.category == catName then table.insert(categoryConfig, v) end
|
if v.category == catName then table.insert(categoryConfig, v) end
|
||||||
end
|
end
|
||||||
|
|
||||||
// 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)
|
||||||
|
|
|
@ -22,13 +22,13 @@ function gmInte.createImgurMaterials(materials, addon_var, folder, name)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
for k, v in pairs(materials) do
|
for k, v in ipairs(materials) do
|
||||||
getMatFromUrl("https://i.imgur.com/" .. v .. ".png", k)
|
getMatFromUrl("https://i.imgur.com/" .. v .. ".png", k)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.redowloadMaterials()
|
function gmInte.redowloadMaterials()
|
||||||
for k, v in pairs(ImageCache) do
|
for k, v in ipairs(ImageCache) do
|
||||||
v.addon_var[v.id] = Material("../data/" .. v.folder .. "/" .. v.id .. ".png", "noclamp smooth")
|
v.addon_var[v.id] = Material("../data/" .. v.folder .. "/" .. v.id .. ".png", "noclamp smooth")
|
||||||
gmInte.log("materials", v.name .. " - Image Redownloaded - " .. v.id .. ".png")
|
gmInte.log("materials", v.name .. " - Image Redownloaded - " .. v.id .. ".png")
|
||||||
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)
|
||||||
|
|
|
@ -34,7 +34,7 @@ local netReceive = {
|
||||||
RunConsoleCommand("changelevel", game.GetMap())
|
RunConsoleCommand("changelevel", game.GetMap())
|
||||||
end,
|
end,
|
||||||
[6] = function(ply) gmInte.verifyPlayer(ply) end,
|
[6] = function(ply) gmInte.verifyPlayer(ply) end,
|
||||||
[7] = function(ply, data) sendPlayerToken(ply) end
|
[7] = function(ply, data) gmInte.sendPlayerToken(ply) end
|
||||||
}
|
}
|
||||||
|
|
||||||
net.Receive("gmIntegration", function(len, ply)
|
net.Receive("gmIntegration", function(len, ply)
|
||||||
|
|
|
@ -66,7 +66,7 @@ end
|
||||||
|
|
||||||
function gmInte.superadminSetConfig(ply, data)
|
function gmInte.superadminSetConfig(ply, data)
|
||||||
if !ply:IsValid() || !ply:IsPlayer(ply) || !ply:IsSuperAdmin() then return end
|
if !ply:IsValid() || !ply:IsPlayer(ply) || !ply:IsSuperAdmin() then return end
|
||||||
for k, v in pairs(data) do
|
for k, v in ipairs(data) do
|
||||||
gmInte.saveSetting(k, v)
|
gmInte.saveSetting(k, v)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -39,13 +39,13 @@ end
|
||||||
local function getCustomValues(ply)
|
local function getCustomValues(ply)
|
||||||
local values = {}
|
local values = {}
|
||||||
// Get compatability values
|
// Get compatability values
|
||||||
for key, value in pairs(getCustomCompatability(ply)) do
|
for key, value in ipairs(getCustomCompatability(ply)) do
|
||||||
values[key] = value
|
values[key] = value
|
||||||
end
|
end
|
||||||
|
|
||||||
// Get custom values or overwrite compatability values
|
// Get custom values or overwrite compatability values
|
||||||
if ply.gmIntCustomValues then
|
if ply.gmIntCustomValues then
|
||||||
for key, value in pairs(ply.gmIntCustomValues) do
|
for key, value in ipairs(ply.gmIntCustomValues) do
|
||||||
values[key] = value
|
values[key] = value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user