Ok, i’m feeling really stupid here. I just want to create a simple code module where I can share some functions globally. I’ve seen other posts discuss this, and i’ve tried to replicate a simple example, but i’m at a loss here. I was following the example from this URL:
lua-users wiki: Modules Tutorial and
http://forum.micasaverde.com/index.php/topic,8237.msg52500.html#msg52500
I’ve created a simple file called “mymodule.lua” and uploaded it through the “Luup files” area.
Contents:
local mymodule = {}
function mymodule.foo()
return true
end
return mymodule
In the “test luup code” area, i’m trying to call it
local mymodule = require("mymodule")
mymodule.foo()
The end result of these few lines of code is an infuriating “code failed”. Is there another example I can look at? What am I doing wrong?