About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Tue Oct 14, 2008 4:18 am   

Feature request for future version...
 
We already have the #LUA command... now I wonder if it'd be possible to have a %lua function.

The reason I say this is because it can help clean up some things with scripting. For instance:

#ALIAS alias1($loc1, $loc2, $loc3) {say The value of the variables chosen average out to be (%float(($loc1+$loc2+$loc3))/3)).}

could be changed to:

#ALIAS alias1($loc1,$loc2,$loc3) {say The value of the variables chosen average out to be %lua(print(($loc1+$loc2+$loc3)/3)).}

Of course, this is just a contrite example. With the extensive capabilities of lua, I think we could have so much more done with this. Imagine using lua tables. I'm not sure how it works or where it stores the information (I don't see an actual variable, far as I can tell), but instead of using space in the package editor for a variable that's only local to you, use lua to store it to a table, and allow the function to call it out... like:

#FORALL %lua(stringlist) {do %i} or whatever.... I think the possibilities are endless with this function. Would make it easier for spellup scripts, equipment scripts, as well as many other aspects.

*shrug*

Just a thought. Then again, some of the stuff listed above would be possible with the command anyway... Heh.

Charneus
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 873
Location: USA

PostPosted: Tue Oct 14, 2008 4:49 am   Re: Feature request for future version...
 
charneus wrote:
We already have the #LUA command... now I wonder if it'd be possible to have a %lua function.
...
Just a thought. Then again, some of the stuff listed above would be possible with the command anyway... Heh.


In the meantime, you could define your own function:

http://forums.zuggsoft.com/modules/mx_kb/kb.php?page=3&mode=doc&k=2476
(help link for CMud manual, "function" command if the link ever breaks)

-Tarn
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Tue Oct 14, 2008 8:08 am   
 
If you really wanted, you could make a function that does assert(loadstring(zs.param(1)))(), which will compile and execute whatever parameter it's given. I just wouldn't use it for anything time-sensitive because compiling takes time.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion 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