Jump to content
  • 0

How to 'os.exit' it, while someone peek at searching value, when gg are searching values?


nio04
 Share

Question

How to 'os.exit' it, while someone peek at searching value values, when gg are searching values? 

 

Saw some script hav this weird feature... They can immediately terminate their script, while someone peeked when gg were searching

 

Do anybody hav clue? Plz share it

Link to comment
Share on other sites

Recommended Posts

  • 0

Actualy my pseudo code is
 

-- Create a coroutine with infinite loop that check if gg.isVisible(true) then os.exit 

-- everytime you call gg.searchNumber make sure to resume the coroutine first then after the search in ended make sure to yield the coroutine 

but i got one problem, my coroutine is getting killed i dont know why

script.lua

Link to comment
Share on other sites

  • 0

Never mind i have just done some research and find out coroutine actually block the main thread even it is executed in another state
i have done some test
 

local thread2 = coroutine.create(function ()
  for i =1, 10 do
    print ("thread2")
  end
end)

local thread1 = coroutine.create(function ()
  coroutine.resume(thread2)
  print ("thread1")
end)

coroutine.resume(thread1)

 

Link to comment
Share on other sites

  • 0

It's because of fundamentals of how Lua is implemented. The implementations (official one and LuaJ) are single-threaded, therefore only one operation can be performed at a time. Nothing can be done about it without changing the implementation.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.