lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Just a sanity check - should there be a problem making these calls within a coroutine (thread) resumed from C? When I try, I get no error but also nothing actually happens. A bit hard to show the code here since it is embedded in a complex C++ application, sorry, but even this:

f = loadstring("print('hello')")
print("f()", f, f())

results in:

f()	function: 0x1095f60

i.e., no 'hello' appears.

The main thread lua state is created like this:

	L = lua_newstate(Lua :: alloc, 0);	
	if (L) {
		//lua_atpanic(L, Lua :: panic);

The main lua file is then loaded into a lua_State * L like this:

	if (luaL_loadfile (L, path))
		printf("dofile error: %s", lua_tostring(L, -1));
		lua_pop(L, 1);

Then resumed like this:

int result = lua_resume(L, lua_gettop(L) - 1); // in case I pushed some args to it

Is this part of the whole yielding across a pcall problem (which I have to admit is still not clear, despite reading many manual entries and lua-list messages).