Jump to content
Sign in to follow this  
fllwr

GG Lua has broken floating point number support?

Recommended Posts

Posted (edited)

e.g. ((1592891810914 / 1000) == 1592891810) evaluates to true in GG

Obviously this is not the default behavior of Lua 5.3.

GG 99.0, arm64

GG_logcat_r99.0_16126_9_28.log.7z

 

In addition to broken division, converting fp number to string yields different result in GG.

print(1592891810914 * 0.001) gives out "1.592891810914E9" in GG, though it is "1592891810.914" in every other lua console I used.

Edited by fllwr

Share this post


Link to post
Share on other sites

Like in Java, first operand define type of operation.

So you need make it float:

((1592891810914.0 / 1000) == 1592891810) -- false

In the second case it is same.

1.592891810914E9 == 1592891810.914

 

Share this post


Link to post
Share on other sites
1 hour ago, Enyby said:

Like in Java, first operand define type of operation.

So you need make it float:


((1592891810914.0 / 1000) == 1592891810) -- false

In the second case it is same.

1.592891810914E9 == 1592891810.914

 

It doesn't make sense and violates Lua manual, because Lua has separate int-div // and fp-div /. (and no formal way to convert between int/fp)

 

I tested it in other Lua 5.3 build:

((1592891810914 / 1000) == 1592891810) => false

print(1592891810914 * 0.001) => "1592891810.914"

1.592891810914E9 == 1592891810.914 is a problem: it means string conversion is incompatible with other Lua build. (e.g. serialization creates different output)

 

>> ((1592891810914.0 / 1000) == 1592891810) -- false

This is not even a workaround because in practice, since variables could be int or fp.

Maybe +.0 or + -.0 can convert int to fp for variables...

Share this post


Link to post
Share on other sites

Serialization number to string is implementation specific.

Yes. You can do 0.0 + int_var for get float var. First variable define type of result.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • By 272833839393393828
      View File Rocket Royale script 2020
      Ilyâss funny gamer

      Submitter 272833839393393828 Submitted 07/03/2020 Category LUA scripts  
    • By MrXnuv3r
      help me to find more than one value
      I mean, if I look for the value "25" and there are no results, then continue to look for the second value "20".
      but if I look for the value "25" and there are results, then don't look for the second value "20"
      I tried writing the script but GG always read i search value "5"
      sorry for my english
      I hope you understand what I mean
       
    • By fllwr
      I use other script engine/app to automate some game play and  I use GG run some task on demand.
      The problem is, GG script seems to be interrupted if target process is terminated. (Reasonable but block in my way)
      But sometimes I want to kill/restart the game, and therefore need to automate attach/load script.
      To make it happen:
      1. If it is possible to attach process/load script through local IPC or shell command.
          I think it is not possible now.
      2. Automate tap on GG to attach/load script. But there are two major problems to solve:
          A. Find the game process can be non-trivial as the position in list seems unpredictable.
          B. Find GG floating icon can be non-trivial.
       
      Anyway, I would like to request some (trivial) features for menu/UI, which benefits humans and also can make my automation easier.
      1. Add options to sort process list by pid/display name/package name.
          IMO a sorted list is much easier to locate the process.
          (It seems that GG tries to put foremost window's process 1st in list, but not always and other window/process are not sorted.
           In case there is another floating window around, it is most likely that the floating window's app is 1st in list, and the game is at random list position.)
      2. Add a menu entry to set/set floating icon position in menu. Add a menu entry to change floating icon size.
          IMO a smaller floating window (without auto hide) is most convenient.
          Remember and apply accurate floating icon position is much easier than struggle to drag GG to correct region every time.
         (One practical use case is when speedhack is use frequently to tweak speed up/down all the time.
          GG's floating icon is large, and huge if speedhack's arrows is shown -- I knew long press again can hide arrows, but it is inconvenient if I want to change speed all the time)
       
      It would be easiest possible to attach process/load script through local IPC or shell command.
    • By Wisteria
      Please can anyone direct me on how to hack dream league Soccer 2020 coins. Is their anything i can do about it. 
      See picture of game below 
              👇👇👇

×
×
  • Create New...