summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkyren <kerriganw@gmail.com>2018-02-19 18:02:04 -0500
committerkyren <kerriganw@gmail.com>2018-02-19 18:03:18 -0500
commite19a5b648103a4eb3e65912d0763d000d2f9a16d (patch)
treed53d188d685d6ccac238ff44d2f030cff9ebbe49 /src
parentd78420b51cb5c7ce3b4043178209068e03e34148 (diff)
downloadmlua-e19a5b648103a4eb3e65912d0763d000d2f9a16d.zip
Cleanup max upvalues constant a bit, add some luaconf.h assumptions
Diffstat (limited to 'src')
-rw-r--r--src/ffi.rs2
-rw-r--r--src/function.rs4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/ffi.rs b/src/ffi.rs
index 4d1c48e..7568f4a 100644
--- a/src/ffi.rs
+++ b/src/ffi.rs
@@ -34,6 +34,8 @@ pub const LUAI_MAXSTACK: c_int = 1_000_000;
pub const LUA_REGISTRYINDEX: c_int = -LUAI_MAXSTACK - 1000;
pub const LUA_RIDX_MAINTHREAD: lua_Integer = 1;
pub const LUA_RIDX_GLOBALS: lua_Integer = 2;
+// Not actually defined in lua.h / luaconf.h
+pub const LUA_MAX_UPVALUES: c_int = 255;
pub const LUA_TNONE: c_int = -1;
pub const LUA_TNIL: c_int = 0;
diff --git a/src/function.rs b/src/function.rs
index c75990e..f41a76c 100644
--- a/src/function.rs
+++ b/src/function.rs
@@ -146,12 +146,10 @@ impl<'lua> Function<'lua> {
let lua = self.0.lua;
unsafe {
stack_err_guard(lua.state, 0, || {
- const MAX_LUA_UPVALUES: c_int = 255;
-
let args = args.to_lua_multi(lua)?;
let nargs = args.len() as c_int;
- if nargs + 2 > MAX_LUA_UPVALUES {
+ if nargs + 2 > ffi::LUA_MAX_UPVALUES {
return Err(Error::BindError);
}