我的openwrt学习笔记(三十五):Openwrt 之luci-lua调用uci的测试
来源:互联网 发布:淘宝粉丝排名前十店铺 编辑:程序博客网 时间:2024/05/29 19:25
我的openwrt学习笔记(三十五):Openwrt之luci-lua调用uci的测试
好了 ,lua 学习 , uci也学习了,接下来就是luci
Lua中使用UCI 例子:
Luci文件源代码:
linux@ubuntu:~/linux_c/lua/lua-5.1.5/luca_study$cat test1.luci
#!/usr/bin/lua
--helloworld lua program
print("Hello World!")
require("uci")
-- Get asection type or an option
x =uci.cursor()
a =x:get("test", "abc", "test_var")
print(a)
-- Getthe configuration directory
b =x:get_confdir()
print(b)
-- Getall sections of a config or all values of a section
d =x:get_all("test", "abc")
print(d)
print(d["test_var"])
print(d["test_var2"])
uci 文件具体内容
linux@ubuntu:/etc/config$pwd
/etc/config
linux@ubuntu:/etc/config$cat test
config'test' 'abc'
option 'test_var' 'value'
option 'test_var2' 'value22'
执行测试输出结果:
linux@ubuntu:~/linux_c/lua/lua-5.1.5/luca_study$lua test1.luci
HelloWorld!
value
/etc/config
table:0x9190018
value
value22
Luci api
http://luci.subsignal.org/api/luci/
http://wiki.openwrt.org/doc/techref/uci#api
- 我的openwrt学习笔记(三十五):Openwrt 之luci-lua调用uci的测试
- 我的openwrt学习笔记(三十四):Openwrt之uci 在ubuntu中的测试
- 我的openwrt学习笔记(三十二):openwrt 的UCI
- 我的openwrt学习笔记(三十三):Openwrt 之lua 在ubuntu中的测试
- 为什么openwrt要使用Luci (lua + uci)
- OpenWrt UCI 学习笔记
- [openwrt] uci 的shell和lua接口
- openWRT学习之LUCI之二访问controller下lua文件的函数
- openwrt uci的使用
- Openwrt的uci操作
- OpenWrt的UCI系统
- 我的openwrt学习笔记(十三):MT7688 串口测试
- 我的openwrt学习笔记(一):OpenWrt简介
- 我的openwrt学习笔记(四):OpenWrt源代码下载
- OPENWRT 入门( opkg, uci, luci )
- 我的openwrt学习笔记(三十):webserver之uhttpd
- openwrt中luci学习笔记
- openwrt中luci学习笔记
- Mac OS X 启动过程
- Linux 安装 Apache
- 解决php写入mysql乱码问题汇总
- Memory of process
- 结构体讲解(一)
- 我的openwrt学习笔记(三十五):Openwrt 之luci-lua调用uci的测试
- Mapbox-GL样式参考
- 学习网站
- 单词反转
- 关于eclipse运行报错的问题 kill adb
- iOS开发笔记--什么时候调用layoutSubviews
- BLE 低功耗时钟选择 简单说明
- Android-Animator属性动画( ObjectAnimator , AnimatorSet , ValueAnimator )
- TOEFL/托福Speaking 中的教育类单词_灵格思教育