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 Forum Index
PostGo back to topic
ParkourPenguin
I post too much
Reputation: 150
Joined: 06 Jul 2014
Posts: 4657

PostPosted: Sun Jul 22, 2018 9:27 am    Post subject:

The first is copying global (maybe upvalue) variables to local variables. This could be a minor optimization in a critical part of the code.

The second is the closest thing Lua has to a ternary conditional operator. The "and" and "or" operators short-circuit: if the first operand to "and" / "or" evaluates to false / true respectively, the expression will return the first operand and the second operand will not be evaluated.
That code is equivalent to this:
Code:
local newGroup
if IsInRaid() then
  newGroup = "raid"
elseif IsInGroup() then
  newGroup = "party"
else
  newGroup = false
end

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Post reviews:   Approve 1
Author Review
Dr.Disrespect
Review: Approve
Post reference:
ReviewPosted: Mon Jul 23, 2018 8:09 pm

nice and detailed explanations.
Back to top
View user's profile Send private message
Display:  
Cheat Engine Forum Index


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites