I want something like this:
local co1 = coroutine.create(function()
local evt, _, _, nm, arg1 = event.pull("thread_msg", 2)
-- Pull a "thread_msg" event.
if(nm == coroutine_name)then
print(evt, arg1) -- Print the event name and the argument sent by "thread_msg"
end
end)
coroutine.resume(co1)
event.push("thread_msg", "co1", "") -- Sends a message to the coroutine
I need the coroutine's name. "thread_msg" event sends to all of the running coroutines, same for coroutine.send. I need to obtain the name of coroutine inside the coroutine.
Working with opencomputers with mc version 1.12.2 forge. The architecture of the CPU is lua 5.3. Thanks.