new to lua,
how might i extract the spaces out of a string?
I am naming a file uniquely by using os.date and want to extract the spaces from it…
ie.
local fileName = “file-” … os.date() [import]uid: 3927 topic_id: 3268 reply_id: 303268[/import]
new to lua,
how might i extract the spaces out of a string?
I am naming a file uniquely by using os.date and want to extract the spaces from it…
ie.
local fileName = “file-” … os.date() [import]uid: 3927 topic_id: 3268 reply_id: 303268[/import]
a better question might be how can i set the filename to a format that looks like this:
file-YYYYMMDD-HHMMSS
any help would be awesome… [import]uid: 3927 topic_id: 3268 reply_id: 9764[/import]
The sooner you learn to look for docs, the better off you’ll be. Anytime you get stuck, just go to Google or some other search engine and type in your problem. I dont know Lua either, so I typed in “lua date” and found this page that described how to use os.date():
http://www.lua.org/pil/22.1.html
You pass it a format string that describes what kind parts of the date you’d like. Most other programming languages have similar date functions.
local fileName = “file-” … os.date("%Y%m%d-%H%M%S",os.time())
Good luck. [import]uid: 9562 topic_id: 3268 reply_id: 9786[/import]
perfect! i got it to work. thank you jtal much appreciated. [import]uid: 3927 topic_id: 3268 reply_id: 9787[/import]