Original Post
Hello, I'm using LuaInterface to access Lua from my c# program. In the documentation in says "LuaFunction and LuaUserData objects have a Call method to execute the function, with any number of arguments, and return the function’s return values inside an array.", but I'm not sure how to use it. For example how can I call a function square written in Lua from my c# program? Lua square function: function square (x) return (x * x) end I've tried the following: Lua lua = new Lua(); lua.OpenBaseLib(); lua.DoString("function square (x) return (x * x) end"); LuaFunction f = lua.GetFunction("square"); double[] args = {4}; f.Call(args); But than I get: Unhandled Exception: System.Exception: [string "chunk"]:1: attempt to perform ar ithmetic on local `x' (a userdata value) What is the right way to do it? [Edited by - Teartear on April 13, 2005 11:49:48 AM]