Ejemplo n.º 1
0
        /// <summary>
        /// Implements error. </summary>
        private static int error(Lua L)
        {
            int level = L.optInt(2, 1);

            L.Top = 1;
            if (L.isString(L.value(1)) && level > 0)
            {
                L.insert(L.@where(level), 1);
                L.concat(2);
            }
            L.error(L.value(1));
            // NOTREACHED
            return(0);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Helper for wrap.  This implements the function returned by wrap. </summary>
        private int wrapaux(Lua L)
        {
            Lua co = thread;
            int r  = auxresume(L, co, L.Top);

            if (r < 0)
            {
                if (L.isString(L.value(-1)))   // error object is a string?
                {
                    string w = L.@where(1);
                    L.insert(w, -1);
                    L.concat(2);
                }
                L.error(L.value(-1));   // propagate error
            }
            return(r);
        }