DPropertySheet make a tab a "global" close button, and align text; help with blah.blah() function creation

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

if blah then blah = blah
else blah = {} end

function blah.logeasy(text)
	file.Append("blah/log.txt", text.."

[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…


file.Append("blah/log.txt", text.."


[editline]9th March 2015[/editline]

Okay, the line break doesnt show in the windows editor, but in NPP, but QAC uses the same(
) 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:

if os.date("%Y%m%d") > file.Time("helloworld.txt", "DATA")

[editline]9th March 2015[/editline]

could it be like

if os.date("%Y%m%d") - file.Time("helloworld.txt", "DATA") > 30 then blah end


file.Time returns a timestamp which is in seconds.


will give the number of seconds between now (os.time) and when it was last modified (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

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]

if blah then blah = blah
else blah = {} end

I just have to say this :smiley:

There is no need to set a value to itself

There is completelly no need to do this:

 blah = blah

Because it already is itself.

Which basically means what OP should do is:

blah = blah or {}

bumpedy bump – What about the close button? is there a sheet.doclick function?