Hi guys,
I cannot figure out how to break a long code line in lua.
I have commandArray['SendEmail'] = 'subject#looong body sring#email'
All working just fine but not very comfortable to edit as it is all in one script line (not the output of the email, but the loa code itself).
How do I berak the code into more lines? Tried several thing but no luck.
I would like to achieve somethig like:
commandArray['SendEmail'] = 'subject#body part 1 /break
.. body part 2 /break
.. body part 3 #email'
to make it more convenient for editing.
Thanks
Breaking long string in code
Moderator: leecollings
-
- Posts: 192
- Joined: Monday 12 January 2015 23:27
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: FRANCE
- Contact:
Re: Breaking long string in code
I don't know bit You may use a variable :
body='some text'
body=body..'some text'
body=body..'some text'
Commandarray...= 'subject#'..body..email
body='some text'
body=body..'some text'
body=body..'some text'
Commandarray...= 'subject#'..body..email
My script : https://github.com/jmleglise
RFXTRX433E: Blind Somfy RTS, Portal Somfy Evolvia, chacon IO, Oregon, PIR sensor PT2262
My Last project : Location de vacances a Ouistreham vue mer
KMTronic USB relay
Chinese Z-WAVE: Neo CoolCam
RFXTRX433E: Blind Somfy RTS, Portal Somfy Evolvia, chacon IO, Oregon, PIR sensor PT2262
My Last project : Location de vacances a Ouistreham vue mer
KMTronic USB relay
Chinese Z-WAVE: Neo CoolCam
Re: Breaking long string in code
yeah, the point is that the body itself already contains quite a few variables so I am afraid this would be quite overkill.
Re: RE: Re: Breaking long string in code
So in the end this really seems to be the best option. I have not discovered a better way.jmleglise wrote:I don't know bit You may use a variable :
body='some text'
body=body..'some text'
body=body..'some text'
Commandarray...= 'subject#'..body..email
Thanks a lot, mate.
- jvdz
- Posts: 2334
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Breaking long string in code
Think you can also shorten it to:
Jos
Code: Select all
body = "line1" ..
"line2" ..
"line3" ..
"line4"
print(body)
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Who is online
Users browsing this forum: No registered users and 1 guest