Why do empty spaces cause syntax error?

Post topics about HALion scripting.
Post Reply
misohoza
Member
Posts: 960
Joined: Sun Oct 05, 2014 12:18 am
Contact:

Why do empty spaces cause syntax error?

Post by misohoza »

Whenever I try to copy and paste a script from the forum or from the Steinberg's developer site, the script module gives me a syntax error. This script is copied from the developer site:

Code: Select all

-- find all effects and print their names
effects = this.program:findEffects(true)
 
if effects[1] then
    for i, effect in ipairs(effects) do
        print(effect.name)
    end
else
    print("Could not find any effects!")
end
The script is perfectly ok when typed in manually.

But when I copy and paste it I get this: Syntax Error: 3: unexpected symbol near char(194):
 
After deleting the empty line 3 the first error is fixed but then I get this:
Syntax Error: 4: unexpected symbol near char(194):     for i, effect in ipairs(effects) do

Does anyone know why is this happening and how to fix this?
Win 10 Home, 64 bit, 8 gb ram,
Cubase Pro 10.5, Wavelab Pro 9.5, Halion 6, Dorico 3,
NI Komplete 10 Ultimate, Ozone 7,
UR 44

AposMus
Member
Posts: 230
Joined: Fri Nov 14, 2014 11:41 am
Contact:

Re: Why do empty spaces cause syntax error?

Post by AposMus »

I've had the same issue.

I suspect when you copy scripts from the developer site you use double click to select all, as their tool tip suggests.

For some reason this ads a few blank or "space" ascii characters to the copied script. I've found if you select all text by the normal click and drag way (bottom to top is easiest), you avoid this issue.
Cubase Pro 8.5.2
Halion 6
HSO
Padshop Pro
Dark Planet

misohoza
Member
Posts: 960
Joined: Sun Oct 05, 2014 12:18 am
Contact:

Re: Why do empty spaces cause syntax error?

Post by misohoza »

Thanks AposMus.

At least I know I'm not the only one having this issue.
Unfortunately doing it the way you suggested doesn't work for me either. I can copy it line by line which is not really efficient.

Thanks for confirming.
Win 10 Home, 64 bit, 8 gb ram,
Cubase Pro 10.5, Wavelab Pro 9.5, Halion 6, Dorico 3,
NI Komplete 10 Ultimate, Ozone 7,
UR 44

User avatar
abject39
Member
Posts: 327
Joined: Sat Jan 17, 2015 8:20 pm
Location: Ventura, Ca
Contact:

Re: Why do empty spaces cause syntax error?

Post by abject39 »

You guys are a life saver! I was ready to throw my computer in frustration lol.
My vision is uncompromising: to transcend my clients dreams by mesmerizing their audience with the world's finest audio arrangements and products.

User avatar
Tekknovator
New Member
Posts: 23
Joined: Mon Aug 07, 2017 6:18 pm
Contact:

Re: Why do empty spaces cause syntax error?

Post by Tekknovator »

I always use an external editor such as Atom or VSCode with lua extensions. They show pretty quickly if there is something fishy about your code and you can clean up whitespace stuff. The only annoying thing is that you need to save your script in a lua file before the external editor can open it.
You can configure the external editor in options. Now when you click the edit button it will open the external editor instead of the annoying built in. I guess the build in is really just for glimpsing at a script or making a quick change.

Post Reply

Return to “Halion Scripting”

Who is online

Users browsing this forum: No registered users and 1 guest