View previous topic :: View next topic |
Author |
Message |
bknight2602 Grandmaster Cheater
Reputation: 0
Joined: 08 Oct 2012 Posts: 586
|
Posted: Tue Mar 05, 2013 6:04 pm Post subject: Line continuation symbol |
|
|
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 |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Tue Mar 05, 2013 7:27 pm Post subject: |
|
|
Code: | a = 4 +
7
+ 8
print(a)
|
works good. It gives 19.
_________________
|
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Wed Mar 06, 2013 10:38 am Post subject: |
|
|
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 |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25794 Location: The netherlands
|
Posted: Wed Mar 06, 2013 11:05 am Post subject: |
|
|
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 |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Wed Mar 06, 2013 2:44 pm Post subject: |
|
|
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 |
|
 |
bknight2602 Grandmaster Cheater
Reputation: 0
Joined: 08 Oct 2012 Posts: 586
|
Posted: Thu Mar 07, 2013 7:31 am Post subject: |
|
|
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 |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Thu Mar 07, 2013 9:57 am Post subject: |
|
|
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 |
|
 |
bknight2602 Grandmaster Cheater
Reputation: 0
Joined: 08 Oct 2012 Posts: 586
|
Posted: Thu Mar 07, 2013 12:37 pm Post subject: |
|
|
Yes that is the exact code, thanks
|
|
Back to top |
|
 |
|