2013-11-03 20:16:23 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) 2013 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Author: Leonardo de Moura
|
|
|
|
*/
|
|
|
|
#ifdef LEAN_USE_LUA
|
|
|
|
#include <lua.hpp>
|
|
|
|
namespace lean {
|
|
|
|
void setfuncs(lua_State * L, luaL_Reg const * l, int nup);
|
2013-11-03 22:42:54 +00:00
|
|
|
/**
|
|
|
|
\brief Wrapper for invoking function f, and catching Lean exceptions.
|
|
|
|
*/
|
|
|
|
int safe_function_wrapper(lua_State * L, lua_CFunction f);
|
2013-11-04 23:05:04 +00:00
|
|
|
template<lua_CFunction F> int safe_function(lua_State * L) {
|
2013-11-03 22:42:54 +00:00
|
|
|
return safe_function_wrapper(L, F);
|
|
|
|
}
|
2013-11-03 20:16:23 +00:00
|
|
|
}
|
|
|
|
#endif
|