Go into the "scripts" directory in the NAS Folder ( nimsoft/probes/service/nas/scripts ). and create a lib file (with no .lua extension).
Your nas script :
lib = require "lib"
lib.echo(); // Print Hello World!
Your lib file content :
local mymodule = {}
function mymodule.echo()
print("Hello World!")
end
return mymodule