|
emnaki Wanderer
Joined: 12 May 2007 Posts: 59
|
Posted: 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.
|
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: 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... ;) |
|
|
|
Dharkael Enchanter
Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: 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." |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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.
|
|
|
|
|
|