lean2/src/bindings/lua/lref.h
Leonardo de Moura 6575566f9f fix(lua): rename lua_ref to lref, lua_ref is a macro in LuaJIT
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-14 15:50:56 -08:00

36 lines
778 B
C++

/*
Copyright (c) 2013 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
*/
#include <lua.hpp>
namespace lean {
/**
\brief Reference to Lua object.
*/
class lref {
lua_State * m_state;
int m_ref;
public:
lref():m_state(nullptr) {}
/**
\brief Create a reference to the Lua object at position \c i on \c L stack.
*/
lref(lua_State * L, int i);
lref(lref const & r);
lref(lref && r);
~lref();
lref & operator=(lref const & r);
void push() const;
lua_State * get_state() const { return m_state; }
};
/**
\brief '<' functor for lref.
*/
struct lref_lt_proc {
int operator()(lref const & r1, lref const & r2) const;
};
}