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
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Wed Jun 04, 2008 4:11 pm   

Lua-related request
 
(If this exists, someone please clue me in.)

What I would love is a place, or a method, for putting global Lua functions and variables into packages/sessions for other Lua code to use. I rather liked being able to define a whole mess of things in one script file in MUSHclient and then just calling those functions or referencing those variables from my aliases, triggers, etc.
Reply with quote
Zugg
MASTER


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

PostPosted: Wed Jun 04, 2008 5:39 pm   
 
You should be able to do this in your onLoad event (or in some Lua script alias that you call from onLoad). In fact, any Lua function/variable that you create in one script should still be accessible to other scripts. CMUD doesn't clear the Lua data space before executing scripts.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Jun 04, 2008 6:29 pm   
 
Mmm, CMUD only uses one namespace for Lua, so any functions you create will be visible anywhere. I personally prefer OnConnect to OnLoad, but as long as something somewhere defines the function before something somewhere else tries to use it, it'll work.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Wed Jun 04, 2008 8:58 pm   
 
Okay. I'll try that then! Thanks for the advice.
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