Beispiel #1
0
        /// <summary>
        /// Convert a lua_CFunction to LuaFunction
        /// </summary>
        public static LuaFunction ToFunction(this Lua.lua_CFunction function)
        {
            if (function == null)
            {
                return(null);
            }
            var proxy = LuaCFunctionProxy.GetProxy(function);

            return(proxy != null ? proxy.ManagedFunction : null);
        }
Beispiel #2
0
 /// <summary>
 /// Find or create a proxy for a function
 /// </summary>
 public static LuaCFunctionProxy GetProxy(LuaFunction function)
 {
     if (function == null) return null;
     var result = FindProxy(function);
     if (result == null)
     {
         result = new LuaCFunctionProxy() {
             ManagedFunction = function
         };
         result.UnmanagedFunction = result.InvokeManagementFunction;
         _Proxies.Add(result);
     }
     return result;
 }
Beispiel #3
0
        /// <summary>
        /// Find or create a proxy for a C function
        /// </summary>
        public static LuaCFunctionProxy GetProxy(Lua.lua_CFunction function)
        {
            if (function == null)
            {
                return(null);
            }
            var result = FindProxy(function);

            if (result == null)
            {
                result = new LuaCFunctionProxy()
                {
                    UnmanagedFunction = function
                };
                result.ManagedFunction = result.InvokeUnmanagedFunction;
                _Proxies.Add(result);
            }
            return(result);
        }