call lua module demo

Your Lua modules may be stored in the /.lua/ folder.

In our /.init.lua global scope earlier, we ran the code:

mymodule = require "mymodule"

Which preloaded the /.lua/mymodule.lua module once into the server global memory template from which all request handlers are forked. Therefore, we can just immediately use that module from our Lua Server Pages.

Your mymodule.hello() output is as follows:

Hello World!

go back