This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

os.date("%w")
#1
Hello, I'm having difficulties with a simple script that looks something like this:

value = event.getvalue()
day = os.date("%w")

if (value == true and day == 1) then
    ~do something
end


It seems like the script cannot read the day variable, when I tried doing something like this it actually works, but I'm curious if there's any simple solution to this:

value = event.getvalue()
d = os.date("%w")
grp.write('1/1/1', d)
day = grp.getvalue('1/1/1')

............ (script continues as above)

1/1/1 object can be 2-byte unsigned integer for example, anything basically.
Reply
#2
os.date returns a string, so you should convert it to number explicitly:
Code:
day = os.date("%w")
day = tonumber(day)
Reply
#3
ahh right thanks..
Reply


Forum Jump: