daurnimator / lua.vm.js

The project is superceded by Fengari. See https://fengari.io/
MIT License
835 stars 101 forks source link

Crash On iPhone 4S(IOS 6.1?) #4

Closed sungmin-park closed 10 years ago

sungmin-park commented 11 years ago

Nothing to report. Crash entire safari application. The sample script page works on ios simulator and old retina ipad.

Please let me know, if there are any way to debug that crash.

Anyway, I'm very exciting about this project. I really do need lua's coroutine.

local window = js.global

function sleep(seconds)
  local co = coroutine.running()
  window.setTimeout(function()
      coroutine.resume(co)
  end
  , seconds * 1000)
  coroutine.yield()
end

coroutine.wrap(function()
    print("Sleeping...")
    sleep(1)
    print("This is the lua's coroutine")
end)()
ghost commented 10 years ago

Do co-routines work in Lua.vm.js?

sungmin-park commented 10 years ago

Yes, that sleep example works.

daurnimator commented 10 years ago

That fixes any remaining issues I've been able to come up with regarding your snippet.

The one thing to note is that you should call window:setTimeout with a : instead of a .