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
kendric
Newbie


Joined: 09 Dec 2009
Posts: 8

PostPosted: Wed Jan 13, 2010 5:02 am   

How does session xml work? What is it?
 
So i have a large library of cmud aliases, triggers etc that I use when I mud. I recently wanted to make some global lua functions and saw somewhere about having a session xml and people putting functions in there. Is there some way to make a function that all of my lua triggers\aliases can use? I cannot use the cmud function object and set type to lua as there is a bug currently making it impossible to pass params to functions from lua.

Thanks!
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Jan 13, 2010 1:44 pm   
 
I'm not sure what you mean by "a session xml." What you probably heard people talking about is the fact that Cmud packages are stored as xml. You can see the xml version by opening the Package Editor. Highlight any class, module, trigger, or whatever. At the bottom of the window displaying the code or options for whatever you highlighted is a tab labeled 'xml'. Click that tab to see the xml code for it. You can directly edit the xml if you know what you are doing, but it is easy to corrupt your entire package by not closing fields, or making some other error. Direct editing of the xml is discouraged, and you can't do anything in the xml that you couldn't do with straight cmud code. The main use of the xml display is that you can see the code for an entire class or module together, and you can cut and paste it.

In summary, unless I am misunderstanding what you mean by "a session xml", you can't do anything special with it.
Reply with quote
kendric
Newbie


Joined: 09 Dec 2009
Posts: 8

PostPosted: Thu Jan 14, 2010 8:27 pm   
 
Ok. Thanks. Do you know how to create lua global functions basically, or reusable blocks of code between aliases\triggers.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Jan 14, 2010 9:07 pm   
 
Quote:

Ok. Thanks. Do you know how to create lua global functions basically, or reusable blocks of code between aliases\triggers.


#FUNCTION. Alternatively, there's the #VARFUNC for doing it the older ZMud way. #ALIAS has been used to simulate a function call prior to #FUNCTION, but #ALIAS doesn't return anything back to the caller.

By the way, what is a lua global function?
_________________
EDIT: I didn't like my old signature
Reply with quote
kendric
Newbie


Joined: 09 Dec 2009
Posts: 8

PostPosted: Thu Jan 14, 2010 9:48 pm   
 
In the first post, I mentioned I cannot use cmud functions. This is a LUA related question not a zscript question if that was the confusion. I did have one idea though. In lua a function is a variable. I am not at home to try this now but I am thinking i can just store my functions in cmud variables. So like do:

zs.var.myfunctions.trim=function trim(str) do stuff.... end

Then I can use the trim function from anywhere. I will post if that works. It all depends on if they handle storing lua bytecode in cmud vars.
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