Can someone give me a sample trigger that, when fired, saves and stores the full date, time (hours/min/secs) it was fired to a variable? i'm not sure how to do this even after reading the Lua documentation
Trigger to catch time trigger was fired
Posted by Silencher on Fri 10 Apr 2015 12:31 PM — 2 posts, 13,420 views.
To get a table of the date and time ( http://lua-users.org/wiki/OsLibraryTutorial ):
To save that to an internal script variable, just assign it.
To save tables to a MUSHclient Variable though you have to serialize the table to a string and then later convert it back to a table from its serialized form.
So, per http://www.gammon.com.au/forum/?id=4960
To save it, you could do:
And then to load it later:
And then you'll again have a local script variable that contains a date/time table called date_and_time.
os.date('*t')
To save that to an internal script variable, just assign it.
date_and_time = os.date('*t')
To save tables to a MUSHclient Variable though you have to serialize the table to a string and then later convert it back to a table from its serialized form.
So, per http://www.gammon.com.au/forum/?id=4960
To save it, you could do:
require "serialize"
date_and_time = os.date('*t')
SetVariable ("date_and_time", "date_and_time = " .. serialize.save_simple (date_and_time))
And then to load it later:
assert (loadstring (GetVariable ("date_and_time") or "")) ()
And then you'll again have a local script variable that contains a date/time table called date_and_time.