Logic Machine Forum
os.date("%w") - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: os.date("%w") (/showthread.php?tid=970)



os.date("%w") - Jayce - 30.08.2017

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.


RE: os.date("%w") - admin - 30.08.2017

os.date returns a string, so you should convert it to number explicitly:
Code:
day = os.date("%w")
day = tonumber(day)



RE: os.date("%w") - Jayce - 30.08.2017

ahh right thanks..