save.lua
来自「嵌入式无线路由系统openwrt的web配置工具」· LUA 代码 · 共 27 行
LUA
27 行
#!/usr/bin/lua-- Copyright (C) 2009 OpenRB.comrequire('fslib')data = datajson() or {}if (data ~= nil and data['values'] ~= nil) then file = 'route' type = 'route' if (data['id'] == nil) then uci.init(file) data['id'] = uci.addsection(file, type) else uci.init(file, data['id'], type, true) end for field, value in pairs(data['values']) do if (field == 'gateway' and value == '') then value = '*' end uci.setvalue(file,data['id'], field, value) end uci.commit(file)end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?