Search code examples
luatostring

What is "n:0" as a number representation?


I printed a value using print(v) and got 7:0.

I can't find any reference to a representation format with a colon-zero at the end. (or with a colon-number)

I am not looking for help to change the way a value is displayed. I am looking for an explanation of why this value is being displayed this way. Is it indicating that the value is not quite an integer? Is the value of a special, high-precision type?

lua -v -e 'a="2" ; b=1 ; c=a*b ; print( c, type(c), tostring(c) ) ;'
Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio
2:0 number  2:0

This is QLua 5.3.5 under Android.

Lua 5.4.2 under Windows (lua-5.4.2_Win32_bin.zip, probably from SourceForge) does not do this: It just prints "2".


Solution

  • My question was: What does "7:0" mean as the representation of a number whose value is at least close to 7.

    The answer seems to be: It's a quirk of QLua.

    I tried the online parser at JDoodle:

    • the 5.3 versions all produced "2.0"
    • the 5.4 version produced "2"

    If I pursue this, I think it will have to be with the people associated with QLua.