DPropertySheet make a tab a "global" close button, and align text; help with blah.blah() function cr
5 replies, posted
Hai! I wanted to ask how I could align a SINGLE tab to the right of the whole width, and make it act as a close button for a whole frame? And if possible, is there a way to color/align text of the frame:settitle() function?
And I wanted to create a function like
blah.logeasy(text) but I dont get the Lua doc that good yet, and therefore I wanted to ask for help here, I've seen in other codes that you have to setup the 'blah' or so, and modernmotd does it like
[CODE]if blah then blah = blah
else blah = {} end
function blah.logeasy(text)
file.Append("blah/log.txt", text.."\n")
end[/CODE]
[editline]9th March 2015[/editline]
Okay, I got the logfunction to work now, but it wont do the linebreak, even though I've set it there..
([CODE]file.Append("blah/log.txt", text.."\n")[/CODE])
[editline]9th March 2015[/editline]
Okay, the line break doesnt show in the windows editor, but in NPP, but QAC uses the same(\n) and it even shows in windows editor..?
Bump? :c
[editline]9th March 2015[/editline]
Oh and how do I make like a file.time() difference detector, to detect a file being older than 30 days?
current code:
[code]if os.date("%Y%m%d") > file.Time("helloworld.txt", "DATA")[/code]
[editline]9th March 2015[/editline]
could it be like
[code]if os.date("%Y%m%d") - file.Time("helloworld.txt", "DATA") > 30 then blah end[/code] ?
file.Time returns a [URL="https://www.google.com.au/search?output=search&sclient=psy-ab&q=unix%20timestamp&=&=&oq=&gs_l=&pbx=1"]timestamp[/URL] which is in seconds.
[lua]os.time()-file.Time("helloworld.txt","DATA")[/lua]
will give the number of seconds between now (os.time) and when it was [U]last modified[/U] (NOT always the same as when it was created).
Convert the seconds into days and check > 30.
[lua]local Seconds = os.time()-file.Time("helloworld.txt","DATA")
local Minutes = Seconds/60
local Hours = Minutes/60
local Days = Hours/24
if Days>30 then
--do it
end
--OR SLIGHTLY MORE COMPACT
local Days = Seconds/86400 --86400 is the number of seconds in 24 hours[/lua]
More edit:
Using your original code
[lua]if os.date("%Y%m%d") - file.Time("helloworld.txt", "DATA") > 30 then blah end[/lua]
it could be done as
[lua]if os.time() - file.Time("helloworld.txt", "DATA") > 30*86400 then blah end[/lua]
[CODE]if blah then blah = blah
else blah = {} end
[/CODE]
I just have to say this :D
There is no need to set a value to itself
There is completelly no need to do this:
[CODE] blah = blah[/CODE]
Because it already is itself.
[QUOTE=Newjorciks;47298013][CODE]if blah then blah = blah
else blah = {} end
[/CODE]
I just have to say this :D
There is no need to set a value to itself
There is completelly no need to do this:
[CODE] blah = blah[/CODE]
Because it already is itself.[/QUOTE]
Which basically means what OP should do is:
[code]blah = blah or {}[/code]
bumpedy bump -- What about the close button? is there a sheet.doclick function?
Sorry, you need to Log In to post a reply to this thread.