public static bool CheckBinaryString(IntPtr ptr, int p, out byte[] bytes)
        {
            if (LuaNativeMethods.lua_isstring(ptr, p))
            {
                bytes = LuaNativeMethods.lua_tobytes(ptr, p);
                return(true);
            }

            bytes = null;
            return(false);
        }
        public static bool CheckType(IntPtr ptr, int p, out string v)
        {
            if (LuaNativeMethods.lua_isuserdata(ptr, p) > 0)
            {
                object o = CheckObj(ptr, p);
                if (o is string)
                {
                    v = o as string;
                    return(true);
                }
            }
            else if (LuaNativeMethods.lua_isstring(ptr, p))
            {
                v = LuaNativeMethods.lua_tostring(ptr, p);
                return(true);
            }

            v = null;
            return(false);
        }