forgottenserver icon indicating copy to clipboard operation
forgottenserver copied to clipboard

Integer values are displayed as float

Open xmish opened this issue 2 years ago • 4 comments

Before creating an issue, please ensure:

  • [x] This is a bug in the software that resides in this repository, and not a support matter (use https://otland.net/forums/support.16/ for support)
  • [x] This issue is reproducible without changes to the C++ code in this repository

Steps to reproduce (include any configuration/script required to reproduce)

Some values are shown as floating point (probably related to changes in lua 5.3+)

  1. Look at watch to see the time
  2. execute /clean
  3. execute !pos
  4. step on depot tile (item count)

FYI: I achieved expected behavior thanks to some changes in code:

  • changed lua_pushnumber to lua_pushinteger (ofc. not everywhere because for e.g. ExperienceStages are of type float)

Expected behaviour

All of these numbers should be presented as integer:

image

Actual behaviour

  • watch time
  • !pos cordinates
  • /clean result message
  • depot item count

image

Environment

TFS master branch: 954bb014ee3a5320fa2cd291922ff178c5b7a0a5 (unmodified) Windows 10 Pro (22H2) Microsoft Visual Studio 2022 Debug/Release x64 Lua version: 5.4.4 OTClient (mehah)

xmish avatar Sep 01 '23 23:09 xmish

On luaJIT it works fine, so it's not a big problem

xmish avatar Sep 02 '23 00:09 xmish

Definitely related to Lua 5.4, since it separated floating point numbers from integers and we only push floating point due to LuaJIT not supporting integers. The easy solution is to just drop LuaJIT support, it's not as useful as it used to be and is stuck in Lua 5.1

ranisalt avatar May 26 '24 22:05 ranisalt