Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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!
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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
Code:
jo
blow


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.
Code:
nil
nil


These may actually be two separate but related bugs. Only Zugg can say for sure.
_________________
Asati di tempari!
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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!
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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!
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Mar 02, 2008 1:06 am   
 
The double quotes you had in the original script. Sorry, I should've made that clear.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Mar 03, 2008 5:37 pm   
 
Added to bug list.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Jun 05, 2008 9:48 pm   
 
Fixed for v2.26
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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. Laughing
_________________
Asati di tempari!
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Jun 05, 2008 10:18 pm   
 
You just *had* to say that, didn't you Wink
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net