Posted 09 December 2015 - 09:43 PM
If I understand correctly, string.find(string, char) works by going over each character (or set of characters) of the string and compares it/them with the char that it was given.
So, by this logic, this should work:
For some reason, print(var_time) returns a correct form of <0.000; 24.000) but the find command returns a value of 1, although the dot is clearly in the position of either 2 or 3.
Am I missing something with the os.time return value?
http://prntscr.com/9cawf9 - Screenshot, to better visualize what I'm seeing
So, by this logic, this should work:
local var_time = tostring(os.time())
print(var_time)
print(string.find(var_time, "."),";")
--[[
The final form should be this:
print(string.sub(var_time, 1, string.find(var_time, ".") - 1)
--]]
For some reason, print(var_time) returns a correct form of <0.000; 24.000) but the find command returns a value of 1, although the dot is clearly in the position of either 2 or 3.
Am I missing something with the os.time return value?
http://prntscr.com/9cawf9 - Screenshot, to better visualize what I'm seeing