So this is my first test at creating a separate code file that I can call from my startup script…
First, I create my file and upload it:
[code]module(“L_MyModule”, package.seeall)
function TestSendMail1()
luup.call_action(gtVSP.gsServiceSMTPNotification1, “SendEmail”, { Recipient_Name=“MyName”, Recipient_eMail="myemail@address.com", Subject= “Test0”, Message=“Test0”}, gtVSP.giSMTPID)
end
function TestSendMail2(sName, sEmailAddress, sSubject, sBody)
luup.call_action(gtVSP.gsServiceSMTPNotification1, “SendEmail”, { Recipient_Name=sName, Recipient_eMail=sEmailAddress, Subject=sSubject, Message=sBody }, gtVSP.giSMTPID)
end[/code]
I then try to reference it:
[code]local test = require “L_MyModule”
test.TestSendMail1()
test.TestSendMail2(“MyName”, “myemail@address.com”, “Insided Subcode”, “Insided Subcode”)[/code]
Neither works. But if I do this:
test.TestSendMail1("MyName", "myemail@address.com", "Insided Subcode", "Insided Subcode")
It sends me an email from my TestSendMail1 function correctly…? I’ve been trying to follow this:
http://lua-users.org/wiki/ModulesTutorial
Any help?