lua.vm.js icon indicating copy to clipboard operation
lua.vm.js copied to clipboard

Problem with alert "input:" in io.read() call

Open KataPi opened this issue 9 years ago • 5 comments

Hi daurnimator, I'm not a programmer. I know js on a basic level and I'm learning Lua. I love your work and it helps me to develop scripts locally.

Local and online (http://daurnimator.github.io/lua.vm.js/repl.html link from GitHub) when I call io.read() lua.vm.js returns me an allert window ("input: ") and then another one and then another one ... mee=io.read() print(mee)

In google I found http://kripken.github.io/mloc_emscripten_talk/lua/repl.html# This works well. In io.read () call it give me back only one alert. It works! It's a bug? It's my browser??

Html from second link (http://kripken.github.io/mloc_emscripten_talk/lua/repl.html#) page not work in local with lua.vm.js from your GitHub. What can I do? Can you give me vm from http://kripken.github.io/mloc_emscripten_talk/lua/repl.html# ? or can you fix vm in GitHub?

Tks Kata

KataPi avatar Aug 29 '16 11:08 KataPi

heh. I didn't even know stdin was hooked up to prompt.

Looks like this is an emscripten bug. I guess you'll have to file it over there? ping @kripken

daurnimator avatar Aug 29 '16 11:08 daurnimator

Hi daurnimator, thanks for reply.

I do not think is an emscripten bug. In his page it works. When I built/installed emscripten from your GitHub with make it gave me a lot of errors but my local page works as your web page, so I did not worry...

Your ping calls him on this issue? Waiting @kripken ...

Tks Kata

KataPi avatar Aug 29 '16 14:08 KataPi

By default emscripten hooks up stdin to window.prompt, yes. It sounds like something changed in that handling, as an old version worked but not the new one? The best thing would be to bisect in both repos, I guess, to find out what changed.

kripken avatar Aug 29 '16 15:08 kripken

@kripken Wouldn't it be bisecting emscripten that's helpful here?

As far as I can tell, it's something weird happening inside of fread/libc/syscall emulation, rather than in lua.vm.js.

daurnimator avatar Aug 30 '16 00:08 daurnimator

Yes, but if you upgraded lua here, might need to bisect that too (might use different syscalls).

kripken avatar Aug 30 '16 17:08 kripken