14.09.2023, 07:17
You can use webrequest library in latest firmware to emulate web UI requests:
Code:
webrequest = require('webrequest')
-- user library name
libname = 'test'
-- create user library
params = {
data = {
id = 'user.' .. libname,
name = libname,
type = 'user',
source = true, -- keep source
load = false, -- autoload
description = 'test description',
}
}
res, err = webrequest('scripting', 'save', params)
log(res, err)
-- save user library source
params = {
data = {
id = 'user.' .. libname,
scriptonly = true,
},
script = [[
log('test user library')
]]
}
res, err = webrequest('scripting', 'save', params)
log(res, err)