lua - 如何映射多个配置文件

标签 lua openwrt luci

在openwrt luci上工作。我有多个配置文件,例如:网络无线在映射中面临问题。我使用以下语法进行映射

m = Map("network", translate("Wireless Settings"))

如何在一个模型中映射多个配置文件

最佳答案

要使用ma​​p(),首先我们需要清楚地了解 map 定义及其属性。这是 map 定义

class Map (config, title, description)

这是模型的根对象。

  • config:要映射的配置名称,参见uci文档和 /etc/config 中的文件
  • 标题:用户界面中显示的标题
  • 描述:用户界面中显示的描述

您有两个配置网络无线。好的,让我们开始多个配置文件绑定(bind)过程。首先我们映射网络配置文件,然后我们映射无线配置文件

使用网络配置文件进行映射

m = Map("network", translate("Wireless Settings")) -- We want to edit the uci config file /etc/config/network
m:chain("wireless")
s = m:section(NamedSection, "wan", "") -- Especially the "interface"-sections

注意: m:chain("config") 绑定(bind)第二个配置文件

带有无线配置文件的 map

m1 = Map("wireless","Wireless Network") -- We want to edit the uci config file /etc/config/network
s1 = m1:section(NamedSection,"wifi-iface", "") -- Especially the "interface"-sections

现在为了渲染,我们需要返回我的 map 模型对象

return m,m1

通过这种方式,您可以在一个模型中映射多个配置文件。

关于lua - 如何映射多个配置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36032866/

相关文章:

lua - 检查表是否已创建不起作用

lua - 如何在Lua中删除表?

linux - 在 openwrt 中降级 Linux 内核版本会引发构建错误

c - 如何向内核模块添加额外的依赖项

javascript - Luci openwrt的XHR.get请求中如何传递数组?

eclipse - Eclipse Galileo 有可用的 Lua 插件吗?

eclipse - 不能添加luaeclipse

php - 如何在openwrt中安装配置php

c - 使用 UCI 的 C API 在特定部分下添加选项

linux - 提交openwrt页面后如何重启服务?