[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: "attempt to yield across metamethod/C-call boundary" with LuaJIT but not with Lua
- From: Szymon Gatner <szymon.gatner@...>
- Date: Sun, 16 Oct 2011 01:35:32 +0200
Hi,
this is my first post on this list so I hope I am following all rules properly.
I just encountered the dreadful "attempt to yield across
metamethod/C-call boundary" error.
Worst part is I am getting different behavior with different
lua51.dll. With original Lua 5.1.4
attached code runs fine - no errors but when LuaJIT 1.1.7 is used error occurs.
My question is: is this code correct? If yes, why LuaJIT reports error?
Code:
#include <iostream>
#include <lua.hpp>
#include <luabind/luabind.hpp>
#include <luabind/yield_policy.hpp>
using namespace std;
using namespace luabind;
void func()
{
cout << "c func" << endl;
}
int main()
{
lua_State* L = luaL_newstate();
luaL_openlibs(L);
open(L);
module(L)
[
def("func", func, yield)
];
luaL_dostring(L, "function funcWrap() func() \nprint('resumed') end");
lua_State* coro = lua_newthread(L);
try
{
resume_function<void>(L, "funcWrap");
}
catch (error& e)
{
luabind::object msg(from_stack(L, 1));
cout << e.what() << ":" << msg << cout;
}
cin.get();
}
--
Szymon Gatner
The Lordz Games Studio
www.thelordzgamesstudio.com