Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name = "chunk"></param>
        /// <param name = "name"></param>
        /// <returns></returns>
        public LuaFunction LoadString(byte[] chunk, string name)
        {
            int oldTop = luaState.GetTop();

            executing = true;

            try
            {
                if (luaState.LoadBuffer(chunk, name) != LuaStatus.OK)
                {
                    ThrowExceptionFromError(oldTop);
                }
            }
            finally
            {
                executing = false;
            }

            var result = translator.GetFunction(luaState, -1);

            translator.PopValues(luaState, oldTop);
            return(result);
        }