From 27be2d4a93acc70c3cdfe14c80514d1ae0273f18 Mon Sep 17 00:00:00 2001 From: selenil Date: Tue, 31 Mar 2026 11:25:40 -0400 Subject: [PATCH] add gc function --- CHANGELOG.md | 4 ++++ src/glua.gleam | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e84f790..3d0e495 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [v2.0.0] + +- [glua] Added a `gc` function to manually run the garbage collector on a Lua state. + ## [v2.0.0-rc.1] - 2026-03-16 - [glua] Changed encoders functions to not accept and return a Lua VM when is not needed. diff --git a/src/glua.gleam b/src/glua.gleam index a0272dc..077d81a 100644 --- a/src/glua.gleam +++ b/src/glua.gleam @@ -839,6 +839,10 @@ pub fn sandbox(state lua: Lua, keys keys: List(String)) -> Result(Lua, Error(e)) @external(erlang, "glua_ffi", "sandbox_fun") fn sandbox_fun(msg: String) -> Value +/// Runs the garbage collector on the given Lua state. +@external(erlang, "luerl", "gc") +pub fn gc(state lua: Lua) -> Lua + /// Gets a value in the Lua environment. /// /// ## Examples