Add `push_closure`

This commit is contained in:
William Venner 2022-07-07 18:18:50 +01:00
parent cf37264d9a
commit 64ade67496
3 changed files with 8 additions and 2 deletions

2
Cargo.lock generated
View File

@ -109,7 +109,7 @@ dependencies = [
[[package]]
name = "gmod"
version = "15.0.1"
version = "15.0.2"
dependencies = [
"cfg_table",
"cstr",

View File

@ -1,6 +1,6 @@
[package]
name = "gmod"
version = "15.0.1"
version = "15.0.2"
authors = ["William Venner <william@venner.io>"]
edition = "2021"
license = "MIT"

View File

@ -315,6 +315,12 @@ impl LuaState {
(LUA_SHARED.lua_pushcclosure)(*self, func, 0)
}
#[inline(always)]
pub unsafe fn push_closure(&self, func: LuaFunction, n: i32) {
debug_assert!(n <= 255, "Can't push more than 255 arguments into a closure");
(LUA_SHARED.lua_pushcclosure)(*self, func, n)
}
#[inline(always)]
pub unsafe fn set_table(&self, index: i32) {
(LUA_SHARED.lua_settable)(*self, index)