improve mconfdialog
This commit is contained in:
@@ -252,14 +252,16 @@ function mconfdialog:show_help()
|
||||
if config.kind then
|
||||
text = text .. "\ntype: " .. config.kind
|
||||
end
|
||||
if config.default then
|
||||
text = text .. "\ndefault: " .. tostring(config.default)
|
||||
end
|
||||
if config.kind == "choice" then
|
||||
if config.default and config.values[config.default] then
|
||||
text = text .. "\ndefault: " .. config.values[config.default]
|
||||
end
|
||||
text = text .. "\nvalues: "
|
||||
for _, value in ipairs(config.values) do
|
||||
text = text .. "\n - " .. value
|
||||
end
|
||||
elseif config.default then
|
||||
text = text .. "\ndefault: " .. tostring(config.default)
|
||||
end
|
||||
if config.path then
|
||||
text = text .. "\npath: " .. config.path
|
||||
|
@@ -69,7 +69,7 @@ function demo:init()
|
||||
table.insert(configs, menuconf.number {value = 6, default = 10, description = "number config item"})
|
||||
table.insert(configs, menuconf.string {value = "x86_64", description = "string config item"})
|
||||
table.insert(configs, menuconf.menu {description = "menu config item", configs = configs_sub})
|
||||
table.insert(configs, menuconf.choice {value = 3, values = {1, 5, 6, 7}, description = "choice config item"})
|
||||
table.insert(configs, menuconf.choice {value = 3, values = {1, 5, 6, 7}, default = 2, description = "choice config item"})
|
||||
|
||||
-- init menu config dialog
|
||||
self:dialog_mconf():load(configs)
|
||||
|
Reference in New Issue
Block a user