0

I have function, which run some unknown code in LuaRuntime in thread, ex

def lua(code):
    lua = LuaRuntime()
    lua.execute(code)

def lua_in_thread(code):
    t = threading.Thread(target = lua, args = (code,))
    t.start()
    return t

Where code is

a = 1
while a == 1 do end

Is there any way to stop the thread? I read about check for variable in condition of infinitive loop, but there code unknown, and I can not guarantee that there will be such a check.

Rubikoid
  • 3
  • 2
  • Not what you asked, but `args = (code)` should be `args = (code,)` to make it a tuple. – zvone Oct 29 '16 at 20:38
  • As for the question, see http://stackoverflow.com/questions/323972/is-there-any-way-to-kill-a-thread-in-python – zvone Oct 29 '16 at 20:44
  • @zvone About tuple - fixed. About response - i have seen this topic, as I understand - there using condition way. Or i should use raising exception? – Rubikoid Oct 29 '16 at 21:24

0 Answers0