From 7f31fefe6beeaad94fdc6d95afcc425f291e65e4 Mon Sep 17 00:00:00 2001 From: Logen Kain Date: Thu, 18 May 2017 10:17:16 -0700 Subject: [PATCH] lua: added time --- lua/time/main.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 lua/time/main.lua diff --git a/lua/time/main.lua b/lua/time/main.lua new file mode 100644 index 0000000..17b7115 --- /dev/null +++ b/lua/time/main.lua @@ -0,0 +1,15 @@ + +-- Create a table named time to store current time +time = os.date("*t") + +-- Old stand by +print (time.year .. "-" .. time.month .. "-" .. time.day) + +-- Allow for beter control, seems to print up to 2 decimal places +-- Not actually sure how this works +-- The first number seems to add perceding spaces +-- The second number seems to add perceding 0's +print (("%02d-%02d-%02d"):format(time.year, time.month, time.day)) + +-- Concat with a deliminator noted at the end +print (table.concat({time.year, time.month, time.day}, "-"))