我正在尝试为Luci的 OpenWRT 模块构建 Web 界面。我有以下代码:
m = Map("amld_cbi", translate ("amld_status"))
s = m:section(TypedSection, "amld_conf","Status")
fqdn = s:option(DummyValue, "fqdn", "FQDN value")
这适用于在屏幕上显示 fqdn(位于 amld_cbi 内)的值。现在我想要字符串值本身。
当我尝试这样做时:
m = Map("amld_cbi", translate ("amld_status"))
s = m:section(TypedSection, "amld_conf","Status")
fqdn = s:option(DummyValue, "fqdn", "FQDN value")
luci.sys.call("amld " .. fqdn)
我收到以下错误:
The called action terminated with an exception:
/usr/lib/lua/luci/model/cbi/amld/amld_status.lua:25: attempt to concatenate global 'fqdn' (a table value)
stack traceback:
[C]: in function 'assert'
/usr/lib/lua/luci/dispatcher.lua:448: in function 'dispatch'
/usr/lib/lua/luci/dispatcher.lua:195: in function </usr/lib/lua/luci/dispatcher.lua:194>
有人知道如何从变量 fqdn 中获取实际值吗?