From e0f065b678a00ab15888089b2cdd4b575cda305b Mon Sep 17 00:00:00 2001
From: Filip Tibell <filip.tibell@gmail.com>
Date: Sun, 12 May 2024 17:13:48 +0200
Subject: [PATCH 1/6] Remove unused env_logger dependency from lune crate

---
 Cargo.lock             | 30 ------------------------------
 crates/lune/Cargo.toml |  9 +--------
 2 files changed, 1 insertion(+), 38 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 988c44a..bf095de 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -779,29 +779,6 @@ version = "0.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d"
 
-[[package]]
-name = "env_filter"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea"
-dependencies = [
- "log",
- "regex",
-]
-
-[[package]]
-name = "env_logger"
-version = "0.11.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9"
-dependencies = [
- "anstream",
- "anstyle",
- "env_filter",
- "humantime",
- "log",
-]
-
 [[package]]
 name = "equivalent"
 version = "1.0.1"
@@ -1182,12 +1159,6 @@ version = "1.0.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
 
-[[package]]
-name = "humantime"
-version = "2.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
-
 [[package]]
 name = "hyper"
 version = "0.14.28"
@@ -1478,7 +1449,6 @@ dependencies = [
  "console",
  "dialoguer",
  "directories",
- "env_logger",
  "futures-util",
  "include_dir",
  "lune-roblox",
diff --git a/crates/lune/Cargo.toml b/crates/lune/Cargo.toml
index 4e43302..81ced84 100644
--- a/crates/lune/Cargo.toml
+++ b/crates/lune/Cargo.toml
@@ -44,13 +44,7 @@ std = [
     "std-task",
 ]
 
-cli = [
-    "dep:env_logger",
-    "dep:clap",
-    "dep:include_dir",
-    "dep:rustyline",
-    "dep:zip_next",
-]
+cli = ["dep:clap", "dep:include_dir", "dep:rustyline", "dep:zip_next"]
 
 [lints]
 workspace = true
@@ -82,7 +76,6 @@ lune-utils = { version = "0.1.0", path = "../lune-utils" }
 
 ### CLI
 
-env_logger = { optional = true, version = "0.11" }
 clap = { optional = true, version = "4.1", features = ["derive"] }
 include_dir = { optional = true, version = "0.7", features = ["glob"] }
 rustyline = { optional = true, version = "14.0" }

From 1d0bab5e650087a1923c8ba8ff90d7a8cb077c25 Mon Sep 17 00:00:00 2001
From: Filip Tibell <filip.tibell@gmail.com>
Date: Sun, 12 May 2024 17:51:15 +0200
Subject: [PATCH 2/6] Fix readme field in lune crate

---
 crates/lune/Cargo.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crates/lune/Cargo.toml b/crates/lune/Cargo.toml
index 81ced84..331e8cb 100644
--- a/crates/lune/Cargo.toml
+++ b/crates/lune/Cargo.toml
@@ -5,7 +5,7 @@ edition = "2021"
 license = "MPL-2.0"
 repository = "https://github.com/lune-org/lune"
 description = "A standalone Luau runtime"
-readme = "README.md"
+readme = "../../README.md"
 keywords = ["cli", "lua", "luau", "runtime"]
 categories = ["command-line-interface"]
 

From 43de7b277a07b11768f5f01872377da49b2ce2a2 Mon Sep 17 00:00:00 2001
From: Filip Tibell <filip.tibell@gmail.com>
Date: Sun, 12 May 2024 17:57:39 +0200
Subject: [PATCH 3/6] Bump chrono dependency versions

---
 Cargo.lock                          | 8 ++++----
 crates/lune-std-datetime/Cargo.toml | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index bf095de..13912ef 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -412,9 +412,9 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
 
 [[package]]
 name = "chrono"
-version = "0.4.34"
+version = "0.4.38"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b"
+checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
 dependencies = [
  "android-tzdata",
  "iana-time-zone",
@@ -426,9 +426,9 @@ dependencies = [
 
 [[package]]
 name = "chrono_lc"
-version = "0.1.5"
+version = "0.1.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "809c968b91b4949802fba00279fd0610158cbb2ae5f10663f0c3d5331f88d6d6"
+checksum = "aa1812634894df89eb9d5075eba0b97d42b4affe477bde7d0db3d2cf8454a800"
 dependencies = [
  "chrono",
  "lazy_static",
diff --git a/crates/lune-std-datetime/Cargo.toml b/crates/lune-std-datetime/Cargo.toml
index 6cb5499..5689b61 100644
--- a/crates/lune-std-datetime/Cargo.toml
+++ b/crates/lune-std-datetime/Cargo.toml
@@ -16,7 +16,7 @@ workspace = true
 mlua = { version = "0.9.7", features = ["luau"] }
 
 thiserror = "1.0"
-chrono = "=0.4.34" # NOTE: 0.4.35 does not compile with chrono_lc
-chrono_lc = "0.1"
+chrono = "0.4.38"
+chrono_lc = "0.1.6"
 
 lune-utils = { version = "0.1.0", path = "../lune-utils" }

From 95b81d65feab20c436ea6ff392fc8d684a95d684 Mon Sep 17 00:00:00 2001
From: Filip Tibell <filip.tibell@gmail.com>
Date: Sun, 12 May 2024 18:01:04 +0200
Subject: [PATCH 4/6] Bump lune std crate versions for latest lune-std-datetime

---
 Cargo.lock                          | 4 ++--
 crates/lune-std-datetime/Cargo.toml | 2 +-
 crates/lune-std/Cargo.toml          | 4 ++--
 crates/lune/Cargo.toml              | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 13912ef..cf0e82d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1487,7 +1487,7 @@ dependencies = [
 
 [[package]]
 name = "lune-std"
-version = "0.1.0"
+version = "0.1.1"
 dependencies = [
  "lune-std-datetime",
  "lune-std-fs",
@@ -1509,7 +1509,7 @@ dependencies = [
 
 [[package]]
 name = "lune-std-datetime"
-version = "0.1.0"
+version = "0.1.1"
 dependencies = [
  "chrono",
  "chrono_lc",
diff --git a/crates/lune-std-datetime/Cargo.toml b/crates/lune-std-datetime/Cargo.toml
index 5689b61..efa5d32 100644
--- a/crates/lune-std-datetime/Cargo.toml
+++ b/crates/lune-std-datetime/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "lune-std-datetime"
-version = "0.1.0"
+version = "0.1.1"
 edition = "2021"
 license = "MPL-2.0"
 repository = "https://github.com/lune-org/lune"
diff --git a/crates/lune-std/Cargo.toml b/crates/lune-std/Cargo.toml
index ed8416d..7ca38e4 100644
--- a/crates/lune-std/Cargo.toml
+++ b/crates/lune-std/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "lune-std"
-version = "0.1.0"
+version = "0.1.1"
 edition = "2021"
 license = "MPL-2.0"
 repository = "https://github.com/lune-org/lune"
@@ -47,7 +47,7 @@ tokio = { version = "1", default-features = false, features = ["fs", "sync"] }
 
 lune-utils = { version = "0.1.0", path = "../lune-utils" }
 
-lune-std-datetime = { optional = true, version = "0.1.0", path = "../lune-std-datetime" }
+lune-std-datetime = { optional = true, version = "0.1.1", path = "../lune-std-datetime" }
 lune-std-fs = { optional = true, version = "0.1.0", path = "../lune-std-fs" }
 lune-std-luau = { optional = true, version = "0.1.0", path = "../lune-std-luau" }
 lune-std-net = { optional = true, version = "0.1.0", path = "../lune-std-net" }
diff --git a/crates/lune/Cargo.toml b/crates/lune/Cargo.toml
index 331e8cb..93ac966 100644
--- a/crates/lune/Cargo.toml
+++ b/crates/lune/Cargo.toml
@@ -70,7 +70,7 @@ reqwest = { version = "0.11", default-features = false, features = [
     "rustls-tls",
 ] }
 
-lune-std = { optional = true, version = "0.1.0", path = "../lune-std" }
+lune-std = { optional = true, version = "0.1.1", path = "../lune-std" }
 lune-roblox = { optional = true, version = "0.1.0", path = "../lune-roblox" }
 lune-utils = { version = "0.1.0", path = "../lune-utils" }
 

From 7e784ba361ba568f76aa17d0d544d170db86dfc0 Mon Sep 17 00:00:00 2001
From: Filip Tibell <filip.tibell@gmail.com>
Date: Sun, 12 May 2024 20:58:00 +0200
Subject: [PATCH 5/6] Fix changelog not having separated added and changed
 sections in latest release

---
 CHANGELOG.md | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index be64496..fb04ac7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## `0.8.4` - May 12th, 2024
 
-### Changed
+### Added
 
 - Added a builtin API for regular expressions.
 
@@ -51,6 +51,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
   Currently supported targets are the same as the ones included with each
   release of Lune on GitHub. Check releases for a full list of targets.
 
+- Added `stdio.readToEnd()` for reading the entire stdin passed to Lune
+
+### Changed
+
 - Split the repository into modular crates instead of a monolith. ([#188])
 
   If you previously depended on Lune as a crate, nothing about it has changed for version `0.8.4`, but now each individual sub-crate has also been published and is available for use:
@@ -64,7 +68,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
   In general, this should mean that it is now much easier to make your own Lune builtin, publish your own flavor of a Lune CLI, or take advantage of all the work that has been done for Lune as a runtime when making your own Rust programs.
 
-- Added `stdio.readToEnd()` for reading the entire stdin passed to Lune
 - Changed the `User-Agent` header in `net.request` to be more descriptive ([#186])
 - Updated to Luau version `0.622`.
 

From 395c36fa8bf58b8b62bafecd8008e7b58ef8f5d0 Mon Sep 17 00:00:00 2001
From: Bryan Cardwell <bjcs.rbx@gmail.com>
Date: Wed, 15 May 2024 05:06:21 -0500
Subject: [PATCH 6/6] Implement idiv support for Vector2 and Vector3 (#196)

---
 .../src/datatypes/types/vector2.rs            | 15 +++++++++
 .../src/datatypes/types/vector3.rs            | 15 +++++++++
 crates/lune-roblox/src/shared/userdata.rs     | 31 +++++++++++++++++++
 tests/roblox/datatypes/Vector2.luau           |  3 ++
 tests/roblox/datatypes/Vector3.luau           |  3 ++
 5 files changed, 67 insertions(+)

diff --git a/crates/lune-roblox/src/datatypes/types/vector2.rs b/crates/lune-roblox/src/datatypes/types/vector2.rs
index e0c352e..343fb70 100644
--- a/crates/lune-roblox/src/datatypes/types/vector2.rs
+++ b/crates/lune-roblox/src/datatypes/types/vector2.rs
@@ -80,6 +80,7 @@ impl LuaUserData for Vector2 {
         methods.add_meta_method(LuaMetaMethod::Sub, userdata_impl_sub);
         methods.add_meta_method(LuaMetaMethod::Mul, userdata_impl_mul_f32);
         methods.add_meta_method(LuaMetaMethod::Div, userdata_impl_div_f32);
+        methods.add_meta_method(LuaMetaMethod::IDiv, userdata_impl_idiv_f32);
     }
 }
 
@@ -138,6 +139,20 @@ impl ops::Div<f32> for Vector2 {
     }
 }
 
+impl IDiv for Vector2 {
+    type Output = Vector2;
+    fn idiv(self, rhs: Self) -> Self::Output {
+        Self((self.0 / rhs.0).floor())
+    }
+}
+
+impl IDiv<f32> for Vector2 {
+    type Output = Vector2;
+    fn idiv(self, rhs: f32) -> Self::Output {
+        Self((self.0 / rhs).floor())
+    }
+}
+
 impl From<DomVector2> for Vector2 {
     fn from(v: DomVector2) -> Self {
         Vector2(Vec2 { x: v.x, y: v.y })
diff --git a/crates/lune-roblox/src/datatypes/types/vector3.rs b/crates/lune-roblox/src/datatypes/types/vector3.rs
index 32387d3..11bcd4a 100644
--- a/crates/lune-roblox/src/datatypes/types/vector3.rs
+++ b/crates/lune-roblox/src/datatypes/types/vector3.rs
@@ -141,6 +141,7 @@ impl LuaUserData for Vector3 {
         methods.add_meta_method(LuaMetaMethod::Sub, userdata_impl_sub);
         methods.add_meta_method(LuaMetaMethod::Mul, userdata_impl_mul_f32);
         methods.add_meta_method(LuaMetaMethod::Div, userdata_impl_div_f32);
+        methods.add_meta_method(LuaMetaMethod::IDiv, userdata_impl_idiv_f32);
     }
 }
 
@@ -199,6 +200,20 @@ impl ops::Div<f32> for Vector3 {
     }
 }
 
+impl IDiv for Vector3 {
+    type Output = Vector3;
+    fn idiv(self, rhs: Self) -> Self::Output {
+        Self((self.0 / rhs.0).floor())
+    }
+}
+
+impl IDiv<f32> for Vector3 {
+    type Output = Vector3;
+    fn idiv(self, rhs: f32) -> Self::Output {
+        Self((self.0 / rhs).floor())
+    }
+}
+
 impl From<DomVector3> for Vector3 {
     fn from(v: DomVector3) -> Self {
         Vector3(Vec3 {
diff --git a/crates/lune-roblox/src/shared/userdata.rs b/crates/lune-roblox/src/shared/userdata.rs
index 9184625..eaaa129 100644
--- a/crates/lune-roblox/src/shared/userdata.rs
+++ b/crates/lune-roblox/src/shared/userdata.rs
@@ -149,6 +149,37 @@ where
     })
 }
 
+pub trait IDiv<Rhs = Self> {
+    type Output;
+    #[must_use]
+    fn idiv(self, rhs: Rhs) -> Self::Output;
+}
+
+pub fn userdata_impl_idiv_f32<D>(_: &Lua, datatype: &D, rhs: LuaValue) -> LuaResult<D>
+where
+    D: LuaUserData + IDiv<D, Output = D> + IDiv<f32, Output = D> + Copy + 'static,
+{
+    match &rhs {
+        LuaValue::Number(n) => return Ok(datatype.idiv(*n as f32)),
+        LuaValue::Integer(i) => return Ok(datatype.idiv(*i as f32)),
+        LuaValue::UserData(ud) => {
+            if let Ok(vec) = ud.borrow::<D>() {
+                return Ok(datatype.idiv(*vec));
+            }
+        }
+        _ => {}
+    };
+    Err(LuaError::FromLuaConversionError {
+        from: rhs.type_name(),
+        to: type_name::<D>(),
+        message: Some(format!(
+            "Expected {} or number, got {}",
+            type_name::<D>(),
+            rhs.type_name()
+        )),
+    })
+}
+
 pub fn userdata_impl_div_i32<D>(_: &Lua, datatype: &D, rhs: LuaValue) -> LuaResult<D>
 where
     D: LuaUserData + ops::Div<D, Output = D> + ops::Div<i32, Output = D> + Copy + 'static,
diff --git a/tests/roblox/datatypes/Vector2.luau b/tests/roblox/datatypes/Vector2.luau
index cccf373..1ed391e 100644
--- a/tests/roblox/datatypes/Vector2.luau
+++ b/tests/roblox/datatypes/Vector2.luau
@@ -39,4 +39,7 @@ assert(Vector2.new(2, 4) / Vector2.new(1, 2) == Vector2.new(2, 2))
 assert(Vector2.new(2, 4) * 2 == Vector2.new(4, 8))
 assert(Vector2.new(2, 4) / 2 == Vector2.new(1, 2))
 
+assert(Vector2.new(7, 15) // Vector2.new(3, 7) == Vector2.new(2, 2))
+assert(Vector2.new(3, 7) // 2 == Vector2.new(1, 3))
+
 -- TODO: Vector math
diff --git a/tests/roblox/datatypes/Vector3.luau b/tests/roblox/datatypes/Vector3.luau
index 64570aa..4a4b745 100644
--- a/tests/roblox/datatypes/Vector3.luau
+++ b/tests/roblox/datatypes/Vector3.luau
@@ -42,4 +42,7 @@ assert(Vector3.new(2, 4, 8) / Vector3.new(1, 1, 2) == Vector3.new(2, 4, 4))
 assert(Vector3.new(2, 4, 8) * 2 == Vector3.new(4, 8, 16))
 assert(Vector3.new(2, 4, 8) / 2 == Vector3.new(1, 2, 4))
 
+assert(Vector3.new(7, 11, 15) // Vector3.new(3, 5, 7) == Vector3.new(2, 2, 2))
+assert(Vector3.new(3, 5, 7) // 2 == Vector3.new(1, 2, 3))
+
 -- TODO: Vector math