[Ironruby-core] ScriptScope.SetVariable - pass in a function

Benjamin van der Veen lists at ruby-forum.com
Sat Nov 15 20:56:03 EST 2008


I'd like do something like this:

public void AddFunction() {
    aScriptScope.SetVariable("my_function", (Action<string>)MyFunction);

public void MyFunction(string value) {
    // do stuff!

Currently if I execute a script like "my_function 'hello!'" or
"my_function('hello!')" I get:

ArgumentException: wrong number or type of arguments for `my_function'

Ideas? If I can, I'd like to declare the class which contains these
methods 'internal'.

Thanks so much!
Posted via http://www.ruby-forum.com/.

More information about the Ironruby-core mailing list