hi people,
i have a router with openwrt 18.06 , in this router i create a new menu for displaying the lte signal, the signal is obtained with a sh script , then in the
/usr/lib/lua/luci/controller/signal-mymodule/signal.lua where i define the menu tree , i add a function to retrieve the data and display it.
all work as excepted
now i wont to rebuild the image with 19.07.3 , and i copy the same file in the new image ... but i have an error
/usr/lib/lua/luci/template.lua:97: Failed to execute template 'signal-mymodule/signal'.
A runtime error occurred: [string "/usr/lib/lua/luci/view/signal-mymodule/sign..."]:1: attempt to call global 'action_test' (a nil value)
stack traceback:
[string "/usr/lib/lua/luci/view/signal-mymodule/sign..."]:1: in main chunk
stack traceback:
[C]: in function 'error'
/usr/lib/lua/luci/template.lua:97: in function
(tail call): ?
/usr/lib/lua/luci/dispatcher.lua:1020: in function 'dispatch'
/usr/lib/lua/luci/dispatcher.lua:478: in function
it's like if it can't find the function, what i'm missing? (i'm noob in lua programming ....)
i've create a git repo with the file to reproduce the problem, inside the file /usr/lib/lua/luci/view/view-mymodule/view_file.htm i recall the function action_test() that is declared int the file /usr/lib/lua/luci/controller/test/file_controller_test.lua , but seems it'snt the place where it is looking for ...
ok, after about 2 hours i can confirm that is a path problem (but i don't know how to solve it!!)
at this time i got a work around , inside the file view_file.htm before calling the function i declare it
<%
local function action_test()
print("pippo")
end
action_test()
%>
but i'd like if someone can explain me how to use a separate file ...