Standard Lua uses 64-bit integers and double-precision (64-bit) floats, but you can also compile Lua so that it uses 32-bit integers and/or single-precision (32-bit) floats.
Which version of Lua does Gideros use? If not 5.3, could it be updated?
"Hexadecimal literals are treated as unsigned numbers by the Lua parser before converting them to the Lua number type. This means they can be out of the range of signed 32 bit integers if the Lua number type has a greater range. E.g. 0xffffffff has a value of 4294967295 in the default installation, but may be -1 on embedded systems."
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
The latest Gideros build, 2015.05.09, uses Lua 5.1. I can confirm Lua 5.1 does not support 64 bit integers. This means it can't take advantage of the 64 bit scoring system in Gamekit and Google Play.
@hgy29, I am testing this on an iOS 64 bit build, but Lua appears to restrict it to 32 bit.
Questions, questions:
1. Can Gideros be upgraded to use Lua 5.3? If so, is this something that would be considered by the Superhero Core Team? 1.1. If not, could the LNUM patch be applied to the current Gideros Lua 5.1? https://github.com/LuaDist/lualnum 1.2. If not, is there a neat workaround for this issue? One solution could be to rewrite, or extend, the Gamekit and Google Play services to work with strings as well as 32 bit integers. 2. LuaJIT. Will using it allow 64 bit integers?
Look forward to thoughts on this, especially from the Core Team.
We are thinking about moving to luajit, main concern being that lua files should not be exported in readable format and that parsing itself should be avoided in mobile platforms. When/if we do this I am pretty sure we will use the latest version available to us. @SinisterSoft is thinking about this move since some time now...
results in: main.lua is uploading. Uploading finished. 4294967295 1103806595071 4294967295
Those numbers are large enough for a score for me.
I don't know what the support is though with regard to getting the >32 bit number out of Lua and into Google Play.
- Anthony
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
The idea is sending a score that also contains data about the previous game session, so a separate database is not needed for that. I could then use that to show data from friends' scores effortlessly and cheaply. That's why I was hoping to use more than 10 digits. Greedy!
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
You should use the lower bits for extra info if you are using facebook score - that way you can divide it and the scores still stay in order.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Thanks Sinister. In the end I chose to modify gamekit.mm to accept strings, which works well in this case. For the save state to work I needed 18 digits in the end.
Comments
Interestingly I found in Lua 5.3 reference manual that it supports 64 bit integers.
https://github.com/gideros/gideros/tree/master/lua
but if you use luajit I think it might be different, might be even cpu specific
Lua 5.1
So i guess 5.1 with the 2014.10 Gideros Studio. So just try with your Gideros version to find out the Lua version.
http://bitop.luajit.org/semantics.html
"Hexadecimal literals are treated as unsigned numbers by the Lua parser before converting them to the Lua number type. This means they can be out of the range of signed 32 bit integers if the Lua number type has a greater range. E.g. 0xffffffff has a value of 4294967295 in the default installation, but may be -1 on embedded systems."
https://deluxepixel.com
The latest Gideros build, 2015.05.09, uses Lua 5.1. I can confirm Lua 5.1 does not support 64 bit integers. This means it can't take advantage of the 64 bit scoring system in Gamekit and Google Play.
@hgy29, I am testing this on an iOS 64 bit build, but Lua appears to restrict it to 32 bit.
Questions, questions:
1. Can Gideros be upgraded to use Lua 5.3? If so, is this something that would be considered by the Superhero Core Team?
1.1. If not, could the LNUM patch be applied to the current Gideros Lua 5.1? https://github.com/LuaDist/lualnum
1.2. If not, is there a neat workaround for this issue? One solution could be to rewrite, or extend, the Gamekit and Google Play services to work with strings as well as 32 bit integers.
2. LuaJIT. Will using it allow 64 bit integers?
Look forward to thoughts on this, especially from the Core Team.
Niclas
Likes: SinisterSoft
x=0xffffffff
print(x)
x=x+0x10000000000
print(x)
x=x-0x10000000000
print(x)
results in:
main.lua is uploading.
Uploading finished.
4294967295
1103806595071
4294967295
Those numbers are large enough for a score for me.
I don't know what the support is though with regard to getting the >32 bit number out of Lua and into Google Play.
- Anthony
https://deluxepixel.com
@SinisterSoft 13 digits, that's good!
The idea is sending a score that also contains data about the previous game session, so a separate database is not needed for that. I could then use that to show data from friends' scores effortlessly and cheaply. That's why I was hoping to use more than 10 digits. Greedy!
https://deluxepixel.com
https://deluxepixel.com