 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: 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 |
|
|
 |
Tarn GURU
Joined: 10 Oct 2000 Posts: 873 Location: USA
|
Posted: 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 |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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.
|
|
|
 |
|
|
|
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
|
|