Summary:
In this topic I wrote lines to a file. And now I want to delete some of the lines again.
This is how notes.hol looks at the moment:
Example: Month=9, Day=11, Year=2012 ... The new notes.hol should look like this then
That's my script at the moment
Code: Select all
function Initialize()
end
function Update()
--Retrieve Measure Settings
Month=SELF:GetOption('Month','')
Year=SELF:GetOption('Year','')
MDay=SELF:GetOption('Day','')
DayMeter=SKIN:GetMeter(MDay)
Day=DayMeter:GetOption("Text")
file=io.input(SKIN:MakePathAbsolute('Holidays/Notes.hol'), 'wb')
if file then
for line in io.lines() do
word=string.gsub(line,'<Event Month="'..Month..'" Day="'..Day..'" Year="'..Year..'">.+</Event>','')
print(word)
--file:write(word)
end
end
io.close(file)
SKIN:Bang('!Refresh')
end
The main problem is that I can't write "word" to my file. "file:write(word)" does nothing and io.write(word) crashs my Rainmeter.
print(word) looks like that:
Hope someone can help me.
EDIT: With "file:write(word)" I get "Script: DeleteNotes.lua:17: Bad file descriptor" in About.