mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 22:07:34 +00:00
add: default value for WS and API fqdn
This commit is contained in:
parent
0ae9631880
commit
b708569ff6
|
@ -233,7 +233,10 @@ local possibleConfig = {
|
||||||
["value"] = function(setting, value)
|
["value"] = function(setting, value)
|
||||||
return value
|
return value
|
||||||
end,
|
end,
|
||||||
|
["resetIfEmpty"] = true,
|
||||||
|
["defaultValue"] = "ws.gmod-integration.com",
|
||||||
["onEdit"] = function(setting, value)
|
["onEdit"] = function(setting, value)
|
||||||
|
if (!value || value == "") then return end
|
||||||
saveConfig(setting, value)
|
saveConfig(setting, value)
|
||||||
end,
|
end,
|
||||||
["onEditDelay"] = 0.5,
|
["onEditDelay"] = 0.5,
|
||||||
|
@ -244,10 +247,13 @@ local possibleConfig = {
|
||||||
["label"] = "API FQDN",
|
["label"] = "API FQDN",
|
||||||
["description"] = "API FQDN that will be used for the API connection.",
|
["description"] = "API FQDN that will be used for the API connection.",
|
||||||
["type"] = "textEntry",
|
["type"] = "textEntry",
|
||||||
|
["resetIfEmpty"] = true,
|
||||||
|
["defaultValue"] = "ws.gmod-integration.com",
|
||||||
["value"] = function(setting, value)
|
["value"] = function(setting, value)
|
||||||
return value
|
return value
|
||||||
end,
|
end,
|
||||||
["onEdit"] = function(setting, value)
|
["onEdit"] = function(setting, value)
|
||||||
|
if (!value || value == "") then return end
|
||||||
saveConfig(setting, value)
|
saveConfig(setting, value)
|
||||||
end,
|
end,
|
||||||
["onEditDelay"] = 0.5,
|
["onEditDelay"] = 0.5,
|
||||||
|
@ -441,7 +447,13 @@ function gmInte.openConfigMenu(data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local isLastID = 0
|
local isLastID = 0
|
||||||
|
local initialValue = value
|
||||||
input.OnChange = function(self)
|
input.OnChange = function(self)
|
||||||
|
if (self:GetValue() == initialValue) then return end
|
||||||
|
if (actualConfig.resetIfEmpty && self:GetValue() == "" && actualConfig.defaultValue) then
|
||||||
|
self:SetText(actualConfig.defaultValue)
|
||||||
|
return
|
||||||
|
end
|
||||||
isLastID = isLastID + 1
|
isLastID = isLastID + 1
|
||||||
local isLocalLastID = isLastID
|
local isLocalLastID = isLastID
|
||||||
timer.Simple(actualConfig.onEditDelay || 0.5, function()
|
timer.Simple(actualConfig.onEditDelay || 0.5, function()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user