private void callCsharpClosure(int nArgs, int nResults, Closure c) { // create new lua stack var newStack = LuaStack.newLuaStack(nArgs + Consts.LUA_MINSTACK, this); newStack.closure = c; // pass args, pop func var args = stack.popN(nArgs); newStack.pushN(args, nArgs); stack.pop(); // run closure pushLuaStack(newStack); var r = c.csharpFunc(this); popLuaStack(); // return results if (nResults != 0) { var results = newStack.popN(r); stack.check(results.Length); stack.pushN(results, nResults); } }
private void callCsharpClosure(int nArgs, int nResults, Closure c) { // create new lua stack var newStack = new LuaStack { state = this, closure = c }; // pass args, pop func if (nArgs > 0) { newStack.pushN(stack.popN(nArgs), nArgs); } stack.pop(); // run closure pushLuaStack(newStack); var r = c.csharpFunc(this); popLuaStack(); // return results if (nResults != 0) { var results = newStack.popN(r); //stack.check(results.Length); stack.pushN(results, nResults); } }