Ejemplo n.º 1
0
std::string Lua::RunScript(std::string script)
{
	int err = luaL_dostring(state.get(), script.c_str());
	if (err != LUA_OK)
	{
		return LuaGetLastError(state.get());
	}
	return "No errors";
}
Ejemplo n.º 2
0
std::string LuaCoroutine::Resume()
{
	PushToStack(state.get());
	lua_State* thread = lua_tothread(state.get(), -1);
	lua_pop(state.get(), 1);
	int status = lua_resume(thread, NULL, lua_gettop(thread));

	if (status != LUA_OK && status != LUA_YIELD)
	{
		return LuaGetLastError(thread);
	}
	return "No errors";
}
Ejemplo n.º 3
0
std::string LuaCoroutine::RunScript(std::string script)
{
	PushToStack(state.get());
	lua_State* thread = lua_tothread(state.get(), -1);
	lua_pop(state.get(), 1);
	int status = luaL_loadstring(thread, script.c_str());
	status = lua_resume(thread, NULL, 0);

	if (status != LUA_OK && status != LUA_YIELD)
	{
		return LuaGetLastError(thread);
	}
	return "No errors";
}