Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Valkenar
Beginner


Joined: 12 Aug 2009
Posts: 15

PostPosted: Wed Nov 04, 2009 5:38 pm   

[3.12] Lua functions and execfunc
 
When an alias or function written in lua attempts to call a function written in a lua using execfunc, the arguments are lost.

For example:

Function1:
zs.say("Function called")
zs.say(zs.params(1))
zs.say("Function end")

Function 2:
zs.execfunc("function1", "hello")

Then on the command prompt enter
#noop @function1(hello)

Outputs:

Function1 called
hello
Function1 End

Next on the command prompt enter
#noop @function2()

Outputs:
Function1 called

Function1 End

It seems only to keep arguments from the command line. For example
#noop @function2(hello)

Outputs:
Function1 called
hello
Function1 End

Even though the argument passed to function2 is never accessed. The lua functions seem to be sharing a common argument scope.

The help file says:
print( zs.execfunc("test",123))
calls the "test" function with the number 123 as the first argument (%1) and prints the value returned from the function

If the current behavior is considered correct, then the help file needs updating.
Reply with quote
Zugg
MASTER


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

PostPosted: Fri Nov 06, 2009 5:24 pm   
 
Confirmed and added to bug list.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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