I'm working on a project at the moment, that contains smurfiers LuaCalendar and the ability to write notes.
Similar like this. The Input measure works and I get all the variables like day, month and year. Now I must write these variables to the new Notes.hol file. And here is my problem
This is my current lua script.
Code: Select all
function Initialize()
end
function Update()
--Retrieve Measure Settings
Month=SELF:GetOption('Month','');
Year=SELF:GetOption('Year','');
UserInput=SELF:GetOption('UserInput','');
MDay=SELF:GetOption('Day','');
DayMeter=SKIN:GetMeter(MDay)
Day=DayMeter:GetOption("Text")
local file = assert(io.input(SKIN:MakePathAbsolute('Notes.hol'), 'a'))
file:write('<Event Month="'..Month..'" Day="'..Day..'" Year="'..Year..'"> '..UserInput..' </Event>')
print(file)
file:close()
SKIN:Bang('!DisableMeasure LuaNotes')
--print('<Event Month="'..Month..'" Day="'..Day..'" Year="'..Year..'"> '..UserInput..' </Event>')
return
end
If I put "print(file)" under "file:close()" I get "file (closed)
And my problem is that I'm not good at lua, though I read the lua io. examples ...
(At the moment the file Notes.hol is in the same folder like the ini/lua. But I wanna put the file then into a subfolder. But I don't understand SKIN:MakePathAbsolute ... But that's the 2.problem )
Hope someone can help me.