String.gsub issues

  1. What do you want to achieve? Time a plugin operation length.

  2. What is the issue? The output from my code is:
    0767 1
    0.76745640000445

wait(5)
local firstTime = os.clock()
wait(0.75)
local lastTime = os.clock()
print(string.gsub(math.floor(math.abs(firstTime - lastTime)*1000)/1000,"%.",""))
print(math.abs(firstTime - lastTime))

If your input is the number 0.767, what do you want the output to be? Your gsub statement removes the period, and it appears to do that successfully given your output.

Note: gsub returns the updated string and the number of occurrences changed, so that’s where that 1 comes from.

How can i remove the number 1?

Hey. How can i remove the number 1?

local answer, repcount = string.gsub(math.floor(math.abs(firstTime - lastTime)*1000)/1000,"%.","");
print(answer)

Lemme try it thanks a lot. Again char minimum on replys.

Works alright thanks a lot :smiley: And again char min.