This plugin is an extension of YALP allowing import of MTA modules for use from within Lua.
Since MTA uses Lua 5.1 while YALP uses Lua 5.3, you'll also need something like this to actually load any MTA module.
Download the latest release for your platform to the "plugins/lua" directory and add "lua/YALP-MTA" (or "lua/YALP-MTA.so" on Linux) to the plugins
line in server.cfg after YALP.
YALP must be at least version 1.1 in order to use this plugin!
Use Visual Studio to build the project on Windows, or make
on Linux.
Simply call require "YALP-MTA"
, which will modify the package loader table to allow importing modules from the "plugins/mta" directory. Global require
function must be present and unmodified.
This example uses the SHA module:
require "YALP-MTA"
local sha = require "sha" -- will check plugins/mta/
for k, v in pairs(sha) do
print(k, v)
end
print(sha.sha256("abc"))
In case the package
table is accessible, package.mpath
can be modified to change the directory where the modules are located.