Skip to main content

All Questions

Tagged with
1 vote
1 answer
39 views

How to run a Lua coroutine in C++ with sol3?

I'm using sol2 (v3.3.0) in C++ to run Lua coroutines. I want to pass a Lua function to C++ and execute it as a coroutine. However, my attempts to convert sol::function to sol::coroutine are not ...
Harumaki's user avatar
1 vote
1 answer
83 views

Lua: await the completion of multiple coroutines

In JavaScript, there's const a, b = await Promise.all([task1(), task2()]) In Python, there's a, b = await asyncio.gather(task1(), task2()) Is there Lua's equivalent of the above? local task1 = ...
Nil Admirari's user avatar
0 votes
0 answers
51 views

Lua: turn MPV's mp.command_native_async into a coroutine

mp.command_native_async allows one to call an external executable from an MPV script. It accepts a completion callback, which receives the results of the call. The following attempt at coroutinization ...
Nil Admirari's user avatar
1 vote
1 answer
137 views

Assistance required with coroutines in roblox studio

I'm trying to make multiple enemies move at once so I'm trying to use coroutines to do it. However, I keep getting this error: "ServerScriptService.Main.Mob:28: invalid argument #1 to 'wrap' (...
code-e-ghast's user avatar
2 votes
1 answer
149 views

Parsing custom arguments to functions in lua

In this post, I want to know if there is any possible way to pass lua functions with custom arguments in coroutines? My first guess was trying to do something like that, but then I understood it ...
Tower's user avatar
  • 27
0 votes
1 answer
51 views

Can you explain me better coroutine and why i am having this output

Here is my logic: local get_package = coroutine.create(function(packageName) local url = "https://registry.npmjs.org/" .. packageName .. "/latest" local cmd = "curl -s ...
Aziz.G's user avatar
  • 3,701
2 votes
1 answer
623 views

Supervising coroutines in Lua

I have written a code that runs multiple tasks one after the other in Lua. There is simply a loop that calls each function and then use the output for the next one and so on. Usually there is no issue,...
cobdmg's user avatar
  • 79
0 votes
1 answer
141 views

Luau Couroutine stopping thread

I'm trying to make a OnChange Event Listener, I thought of using coroutines to poll the value in a loop, and see if it changed, so function Changed(Value) local StartingValue = Value while ...
78ThousandNumbers's user avatar
1 vote
1 answer
665 views

(LUA) Why is this coroutine wrap doesn't seem to work?

My code here: coroutine.wrap(function() local x = os.clock() + 3 repeat until os.clock() >= x print("Hi") end)() print("Bye") Usually, the expected output should ...
Allen's user avatar
  • 35
1 vote
0 answers
118 views

How to handle with return number given by lua_resume?

I have some coroutine handling code like this: int coro_re_num = 0; int coro_state = lua_resume( coro_lua, master_lua, narg, &coro_re_num); if ( coro_state == LUA_OK) { // do something } else ...
jiandingzhe's user avatar
  • 2,057
1 vote
1 answer
240 views

simple Lua corotine test crashed at first run

In brief, the test program creates a coroutine at C++ side, launch it with a Lua-side function and resume several times with some logs. It suddenly crashed at the first call to resume that starts ...
jiandingzhe's user avatar
  • 2,057
-1 votes
1 answer
201 views

Are coroutines in Lua actually multithreaded?

Lua coroutines provide cooperative multithreading, and there can only be one coroutine running at a time. So, how are they even different from a normal block of code (keeping aside cases where there ...
Anon's user avatar
  • 116
3 votes
2 answers
971 views

Simple lua_yield in C not resuming correctly from Lua

I'm just starting to delve into lua coroutines with C and I'm having a problem with what I think should be the simplest example I can come up with. The C: #include <lua.h> #include <lauxlib.h&...
charlieb's user avatar
  • 587
1 vote
0 answers
289 views

Access Lua coroutine from C

I have implemented a co-routine system. When I press ENTER to clear the first textbox, it calls contscript() which in turn calls lua_resume() but it doesn't continue the co-routine. So what do I pass ...
Michael Muniko's user avatar
0 votes
0 answers
594 views

How to block an Lua script from running

I am designing a RPG in C. It's gotten to the point that I've implemented a scripting system. I decided to embed Lua into my game. Currently I register a set of commands in C that I call in Lua. How ...
Michael Muniko's user avatar

15 30 50 per page
1
2 3 4 5
7