|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Sat Mar 01, 2008 6:44 am
[2.18] Lua Parsing Bug in Aliases |
The following code snippets executes as expected when ran from the command line.
Code: |
#forall {jo|blow} {#LUA {print(zs.sys["%i"]) }} |
But when put in an alias generates a parsing error.
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<alias name="testLua">
<value>#forall {jo|blow} {#LUA {print(zs.sys["%i"]) }}</value>
</alias>
</cmud>
|
|
|
_________________ Asati di tempari! |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Sat Mar 01, 2008 5:46 pm |
Ok I did some more work on this and saw that the '%' isn't needed when making the system reference, so this works just as well.
Code: |
#forall {jo|blow} {#LUA {print(zs.sys["%i"]) }} |
and outputs
The updated alias however
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<alias name="testLua">
<value>#forall {jo|blow} {#LUA {print(zs.sys["i"]) }}</value>
</alias>
</cmud> |
has this as its output.
These may actually be two separate but related bugs. Only Zugg can say for sure. |
|
_________________ Asati di tempari! |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Sat Mar 01, 2008 5:59 pm |
Ok... here's another update ( Note I'm keeping them separate so it's not confusing ). The real problem is actually with the double quotes (") when in-lining a Lua script. You get errors using the (") but not when using the single quotes (').
This alias works,
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<alias name="testLua">
<value>#forall {jo|blow} {#LUA { print( 'hello folks'); print( zs.sys['i'] ) }}
</value>
</alias>
</cmud> |
while this one doesn't.
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<alias name="testLua">
<value>#forall {jo|blow} {#LUA { print( "hello folks"); print( zs.sys["i"] ) }}
</value>
</alias>
</cmud> |
Using the double quotes results in a parsing in error in the print command and result in a 'nil', presumably from a failed table lookup, when used with zs.sys |
|
_________________ Asati di tempari! |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sat Mar 01, 2008 9:57 pm |
I'm not at home right now, but my suspicion is that CMUD is stripping the double quotes but not the single quotes and then passing the string to the Lua engine, which is then looking for a variable i that has no value. CMUD won't strip single quotes, but they mean something to the Lua engine, so no error. Try quoting them.
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Sat Mar 01, 2008 10:07 pm |
Fang Xianfu wrote: |
Try quoting them. |
Try quoting what? The single quotes serves as a workaround for now. |
|
_________________ Asati di tempari! |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Mar 02, 2008 1:06 am |
The double quotes you had in the original script. Sorry, I should've made that clear.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Mar 03, 2008 5:37 pm |
Added to bug list.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Jun 05, 2008 9:48 pm |
Fixed for v2.26
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Thu Jun 05, 2008 9:54 pm |
Yay Zugg! 2.26 Should rock and it's should be a far cry form the infamously remembered 1.13.
|
|
_________________ Asati di tempari! |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Jun 05, 2008 10:18 pm |
You just *had* to say that, didn't you
|
|
|
|
|
|