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
emnaki
Wanderer


Joined: 12 May 2007
Posts: 59

PostPosted: Wed Jan 02, 2008 9:45 am   

Calling user made functions from LUA
 
How to call user made functions from the zs object? the func table which LUA keeps for functions do not contain user made functions.
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Wed Jan 02, 2008 10:42 am   
 
A user made function is actually stored inside a variable
#func return5 {#return 5}

But I can't get that to work right
normally you'd do print(zs.var.return5)
to just show the contents of a variable, but I can't seem to get it to work with a user defined function.

The question is why would you be using calling a CMUD user defined function when Lua could just do the function anyway?
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Wed Jan 02, 2008 12:05 pm   
 
Try zs.execfunc
print (zs.execfunc("return5"))
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Jan 02, 2008 5:32 pm   
 
You could also use CMUD's #CALL command to call user-defined functions but, like Guinn says, use Lua functions instead.
_________________
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