Example #1
0
        // Call lua state function with one level field
        public static object OneLevelCall(this LuaState luaState, string key, params object[] args)
        {
#if PROFILE_FILE
            Profiler.BeginSample("SLuaExt.OneLevelCall_state");
            Profiler.BeginSample("SLuaExt.OneLevelCall_state." + key);
#endif
            LuaFunction func = (LuaFunction)luaState.getOneLevelField(key);
            object      res  = null;
            if (func != null)
            {
                res = func.call(args);
            }
#if PROFILE_FILE
            Profiler.EndSample();
            Profiler.EndSample();
#endif
            return(res);
        }