Question for Getinfo()

Posted by Gpan on Mon 21 May 2018 06:24 AM — 2 posts, 13,354 views.

#0
Hi all, i have a question for getinfo(),

EG. now is 2018/05/21 15:30:56, i want to know that what will be gotten by using the getinfo(232), a string or a number? the value is the same as the timestamp or something else.
Australia Forum Administrator #1
According to the documentation:

Template:function=GetInfo
GetInfo

The documentation for the GetInfo script function is available online. It is also in the MUSHclient help file.



Quote:

232 - High-performance counter output (in seconds) (double)


That tells you that you will get a double returned (floating-point number) and that it will represent seconds.

The number of seconds is (I think) from when the PC booted, it is not anything to do with the current date or time.

It is intended for doing precise timing.

If you are using Lua you can get the exact same thing from utils.timer:

http://www.gammon.com.au/scripts/doc.php?lua=utils.timer


Example use:


start = utils.timer ()

-- OR

start = GetInfo (232)

-- do something here, like work out how to escape a maze

finish = utils.timer ()

-- OR

finish = GetInfo (232)

time_taken = finish - start  -- in seconds and fractions of a second


The intention is really for debugging scripts, for example you might wonder if one complex regular expression is faster than lots of simple ones, or if LPEG is faster than a regular expression.