View Single Post
Old 05-15-2019, 06:44 AM   #5
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Regular expressions to the rescue!

Given:
Code:
14.05.2019  21:31
You should be able to use:
Code:
local day, month, year, hour, minute = createdate():match("(\d+)\.(\d+)\.(\d+)\s+(\d+):(\d+)")
https://regex101.com/r/c4z5QM/1

(\d+) just means "find a section containing just digits and grab it for me. The bits in between specify the dots and spaces.

Note: match returns them as strings, so you can use tonumber(day), etc if you have to do math or compare them.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote