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 


[long_crash] in *.lua func

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
fERO
How do I cheat?
Reputation: 0

Joined: 14 Dec 2011
Posts: 4

PostPosted: Wed Dec 14, 2011 9:15 pm    Post subject: [long_crash] in *.lua func Reply with quote

Hello.
Tried to make a wrapper increment, but turned out endlessly cycle.

This function will hang interpreter CEngine tightly.
So much so that it would be long to kill the process ..

(note: sorry if repeated, all the pages look not possible)

Code:

a = 0
i = 0
while i < 10 do
    print(string.format("test: %d",inc2(a,i)))
    if a > 10 then
      break
    end
    -- a = a + 1 -- DEBUG: KILL CYCLE
    inc(i,1) -- <- CRASHED!
end

-- FUNCs: increment
function inc2(arg1, arg2)
 arg1 = arg1 + arg2
 return arg1
end

function inc(arg1)
 arg1 = arg1 + 1
 return arg1
end


There are solutions to this problem?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Wed Dec 14, 2011 10:13 pm    Post subject: Reply with quote

instead of
Code:

inc(i,1)

do
Code:

i=inc(i,1)


As far as I know lua does not support "call by reference" in function parameters (except table objects)

_________________
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
fERO
How do I cheat?
Reputation: 0

Joined: 14 Dec 2011
Posts: 4

PostPosted: Thu Dec 15, 2011 11:53 pm    Post subject: Reply with quote

Is clear. Thanks.
Back to top
View user's profile Send private message
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