Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Cheat Engine Pure 15.06.10 bug?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
RandName
Newbie cheater
Reputation: 0

Joined: 19 Jun 2015
Posts: 22

PostPosted: Fri Jun 19, 2015 4:11 pm    Post subject: Cheat Engine Pure 15.06.10 bug? Reply with quote

Hi,

I have recently downloaded mgr.inz.Player's version of cheat engine (version is in title).
I think it is the latest one (based on the date).

But I have encountered a bug.
Whenever I try to use a method from the math library like math.pow(),
I get an error saying that I am trying to call a nil value.
This is the exact error message:
Code:

Error:[string "print(math.pow(2,2))
..."]:1: attempt to call a nil value (field 'pow')
Script Error


You can download the version from the link in his signature.
(Can't post links yet)

I don't know why, but it worked in the official release.
Can someone help me with this?
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Fri Jun 19, 2015 11:47 pm    Post subject: Reply with quote

Use 2^2 (__pow metamethod) ,
math.pow is deprecated or removed in lua 5.3, new ce use 5.3.

(this should move to beta forum?)
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25296
Location: The netherlands

PostPosted: Sat Jun 20, 2015 2:48 am    Post subject: Reply with quote

i'll see about manually adding math.pow (and other stuff) as this breaks compatibility with older scripts

e. g loadstring seems to be deprecated as well, and i know some greedy/selfish people that use it

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Jun 20, 2015 5:30 am    Post subject: Reply with quote

By the way, Lua 5.3.1 has been released three days ago.


And here http://www.lua.org/bugs.html , they said that string.format("%f") can cause a buffer overflow (only when 'lua_Number' is long double!)

_________________


Last edited by mgr.inz.Player on Sat Jun 20, 2015 7:02 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
RandName
Newbie cheater
Reputation: 0

Joined: 19 Jun 2015
Posts: 22

PostPosted: Sat Jun 20, 2015 6:59 am    Post subject: Reply with quote

panraven wrote:
Use 2^2 (__pow metamethod) ,
math.pow is in lua 5.3, new ce use 5.3.

(this should move to beta forum?)


Hm, that's unfortunate because I used math.frexp() and math.ldexp() in my script to convert hex into float and vice versa.
I know that there is an easier method of converting these and I once saw it here somewhere, but I can't find it anymore.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Jun 20, 2015 7:09 am    Post subject: Reply with quote

Code:

function hextofloat(n)
 return byteTableToFloat(dwordToByteTable(n))
end

function hextodouble(n)
 return byteTableToDouble(qwordToByteTable(n))
end

print(  hextofloat(0x3f800000)   )
print(  hextodouble(0x3ff0000000000000)   )

_________________
Back to top
View user's profile Send private message MSN Messenger
RandName
Newbie cheater
Reputation: 0

Joined: 19 Jun 2015
Posts: 22

PostPosted: Sat Jun 20, 2015 7:14 am    Post subject: Reply with quote

mgr.inz.Player wrote:
Code:

function hextofloat(n)
 return byteTableToFloat(dwordToByteTable(n))
end

function hextodouble(n)
 return byteTableToDouble(qwordToByteTable(n))
end

print(  hextofloat(0x3f800000)   )
print(  hextodouble(0x3ff0000000000000)   )


Ah, that's very helpful!
And the other way round?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25296
Location: The netherlands

PostPosted: Sat Jun 20, 2015 7:18 am    Post subject: Reply with quote

byteTableToDword(floatToByteTable(floatvalue))
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Jun 20, 2015 7:19 am    Post subject: Reply with quote

Code:
function floattohex(n)
 return string.format('%X',byteTableToDword(floatToByteTable(n)))
end

function doubletohex(n)
 return string.format('%X',byteTableToQword(doubleToByteTable(n)))
end

print(  floattohex(1)   )
print(  doubletohex(1)   )


Very Happy

EDIT:
also if you have hex value as a string

myhex= '3f800000'

print( hextofloat('0x'..myhex) )

_________________
Back to top
View user's profile Send private message MSN Messenger
RandName
Newbie cheater
Reputation: 0

Joined: 19 Jun 2015
Posts: 22

PostPosted: Sat Jun 20, 2015 7:24 am    Post subject: Reply with quote

works very well!
Thx again Very Happy

EDIT:
If I am right, I can just use the integer representation as input for the float2hex function, right?
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Jun 20, 2015 8:05 am    Post subject: Reply with quote

yes
_________________
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites