diff options
Diffstat (limited to 'lib/BLua.cc')
-rw-r--r-- | lib/BLua.cc | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/lib/BLua.cc b/lib/BLua.cc index cf0caa4..1c125a2 100644 --- a/lib/BLua.cc +++ b/lib/BLua.cc @@ -17,16 +17,39 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: BLua.cc,v 1.19 2004-07-22 23:38:32 pixel Exp $ */ - -#include <lualib.h> +/* $Id: BLua.cc,v 1.20 2004-07-23 13:08:23 pixel Exp $ */ #include "BLua.h" +#include <lualib.h> #ifndef BUFFERSIZE #define BUFFERSIZE 2048 #endif + + +extern "C" { + void do_lua_lock(lua_State * _L) { + Lua * L; + try { + L = Lua::find(_L); + } catch (GeneralException e) { + return; + } + L->lock(); + } + + void do_lua_unlock(lua_State * _L) { + Lua * L; + try { + L = Lua::find(_L); + } catch (GeneralException e) { + return; + } + L->unlock(); + } +} + class LuaStatics : public Base { public: static const char * getF(lua_State *, void *, size_t *); @@ -450,6 +473,14 @@ Lua * Lua::thread() { return new Lua(lua_newthread(L)); } +int Lua::yield(int nargs) { + return lua_yield(L, nargs); +} + +int Lua::resume(int nresults) { + return lua_resume(L, nresults); +} + Lua * Lua::find(lua_State * _L) throw (GeneralException) { std::map<lua_State *, Lua *>::iterator i; @@ -516,6 +547,10 @@ int Lua::sethook(lua_Hook func, int mask, int count) { return lua_sethook(L, func, mask, count); } +void Lua::do_break() { + lua_break(L); +} + void LuaObject::push(Lua * L) throw (GeneralException) { if (pushed && wantdestruct) { throw GeneralException("Error: object is owned by the LUA script and can not be pushed."); |