Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
Ta©ti Tac0Z

thread question #2

Question

i don't know if this is even possible but what i am trying to do is this

 

NOTE: that is know that useing a thread in this scene is 100% Unnecessary but remeber this is a simple test

--------------------------------------------------------------------------------

thread = require "thread"

e = require "event"

 

running = true

 

t = thread.create(function()

  e.pull("touch")

  

-- i know that i can put a os.exit() here but the thing is to try to get this to work

running = false --<< that

end)

 

while running do

  --some random thing to run a io.read() will be a good combo

 

  print( "you said: "..io.read() )

end

-----------------------------------------------------------------------------------------------

 

so this ends the thread as inspected but does not end the loop my guess is that all things in the thread function is local only but what can i then do to update the "running" value in the global process aka in the while loop???

 

all help will be great

 

--thanks

Link to post
Share on other sites

6 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.