Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
LUA Quote escaping in grandma2
I am struggling to find the best way to nest quotes while developing grandma2 plugins in LUA
This example shows the best solution i've found so far (ESCAPED SiNGLE QUOTES), but unfortunately
the command line doesn't like single quotes either. Any suggestion?
function quote_escaping_example()
gma.echo("Quote escaping example")
gma.cmd('Store Sequence 1.1 "QUOTE ESCAPING"');
-- using escaped single quotes saves correctly the command but it won't work when triggered
gma.cmd('Store Sequence 1.1 Cue 1 /o /nc');
gma.cmd('Label Sequence 1.1 Cue 1 "ESCAPED SINGLE QUOTES"')
gma.cmd('Assign Sequence 1.1 Cue 1 /cmd="Assign Root \'Effects\'.\'Global\'.1 /Groups=4"');
-- while escaped double quotes don't work, the command gets executed immediately and not stored in the cue
gma.cmd("Store Sequence 1.1 Cue 2 /o /nc");
gma.cmd("Label Sequence 1.1 Cue 2 'ESCAPED DOUBLE QUOTES'")
gma.cmd("Assign Sequence 1.1 Cue 2 /cmd='Assign Root \"Effects\".\"Global\".1 /Groups=4'");
return quote_escaping_example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment