public static int ToBytes(IntPtr ptr) { try { byte[] bytes = null; LuaObject.CheckBinaryString(ptr, 1, out bytes); LuaObject.PushValue(ptr, true); LuaObject.PushObject(ptr, bytes); return(2); } catch (System.Exception e) { return(Error(ptr, e)); } }