summaryrefslogtreecommitdiff
path: root/src/util.rs
diff options
context:
space:
mode:
authorkyren <kerriganw@gmail.com>2017-07-27 16:47:06 -0400
committerkyren <kerriganw@gmail.com>2017-07-27 16:47:58 -0400
commita2b77f37a232a487582c72030c1d625ba39a808f (patch)
tree74b1bcbbd6921746ce97e6ce417b6152fe062069 /src/util.rs
parent3adacd55896e8f7752198ef750ea4e5fabc028db (diff)
downloadmlua-a2b77f37a232a487582c72030c1d625ba39a808f.zip
'main_state' fix
Dont' confuse the state we're pushing the registry value for the main state to with the main state itself, pop from the correct state.
Diffstat (limited to 'src/util.rs')
-rw-r--r--src/util.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util.rs b/src/util.rs
index a29a8c9..7808fd2 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -478,9 +478,9 @@ pub unsafe extern "C" fn safe_xpcall(state: *mut ffi::lua_State) -> c_int {
/// Does not call checkstack, uses 1 stack space
pub unsafe fn main_state(state: *mut ffi::lua_State) -> *mut ffi::lua_State {
ffi::lua_rawgeti(state, ffi::LUA_REGISTRYINDEX, ffi::LUA_RIDX_MAINTHREAD);
- let state = ffi::lua_tothread(state, -1);
+ let main_state = ffi::lua_tothread(state, -1);
ffi::lua_pop(state, 1);
- state
+ main_state
}
pub struct WrappedError(pub Error);