• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Lua] Do some natives that returns integer now returns real?

Status
Not open for further replies.
Level 25
Joined
Jun 26, 2020
Messages
1,973
Hello, this question is because when I use the function tostring in an integer value that I get from functions like GetItemCharges or GetHeroLevel it appears with decimals, why? This didn't happen before. I know I can solve it by using the functions I2S or math.floor, but that is too much of a pain.
 
Last edited:
You may want to hook the problem functions to solve the issue so you don't have to repeat the fix everywhere.

Lua:
local oldGetItemCharges = GetItemCharges
GetItemCharges = function(whichItem)
     return math.floor(oldGetItemCharges(whichItem))
end

There's also this library by Bribe [Lua] - Hook
It might work, but is strange why is happening this now.
 
Status
Not open for further replies.
Back
Top