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 


Line continuation symbol

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Tue Mar 05, 2013 6:04 pm    Post subject: Line continuation symbol Reply with quote

Is there a line continuation symbol that could be used if a coded line is LLLLLOOOONNNNNGGGG? MS had "_" at one time for Access and Excel
Back to top
View user's profile Send private message Yahoo Messenger
mgr.inz.Player
I post too much
Reputation: 222

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

PostPosted: Tue Mar 05, 2013 7:27 pm    Post subject: Reply with quote

Code:
a = 4 +
7
+ 8

print(a)


works good. It gives 19.

_________________
Back to top
View user's profile Send private message MSN Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Wed Mar 06, 2013 10:38 am    Post subject: Reply with quote

For strings, just close the quote and .. at the end like this:

Code:

local longString = "this is the first sentence" ..
                   "this is the second sentence" ..
                   "this is the last sentence...";

print( longString );

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Wed Mar 06, 2013 11:05 am    Post subject: Reply with quote

Code:

local longString = [[this is the first sentence
this is the second sentence
this is the last sentence]]


_________________
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
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Wed Mar 06, 2013 2:44 pm    Post subject: Reply with quote

Keep in mind with DB's example, it will consider a line break and actual line break. So his example will print as 3 entirely separate sentences.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Thu Mar 07, 2013 7:31 am    Post subject: Reply with quote

So a line like this:

if tonumber(battlescreen1) == 0 and tonumber(battlescreen2) == 0 and tonumber(battlescreen3) == 255 then

could look like:

"if tonumber(battlescreen1) == 0 and " ..
"tonumber(battlescreen2) == 0 and " ..
"tonumber(battlescreen3) == 0 and " ..
"tonumber(battlescreen4) == 255 then"
Back to top
View user's profile Send private message Yahoo Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Thu Mar 07, 2013 9:57 am    Post subject: Reply with quote

If that's your actual script, no. Since that's Lua code you don't want to make it a string unless you plan on executing the string later on. If you want to break it into separate lines, just put each check on its own line, Lua will process it properly still.

Code:
if tonumber(battlescreen1) == 0 and
tonumber(battlescreen2) == 0 and
tonumber(battlescreen3) == 0 and
tonumber(battlescreen4) == 255 then
    -- Do something here..
end

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Thu Mar 07, 2013 12:37 pm    Post subject: Reply with quote

Yes that is the exact code, thanks
Back to top
View user's profile Send private message Yahoo 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