luvit / lit

Toolkit for developing, sharing, and running luvit/lua programs and libraries.
http://lit.luvit.io/
Apache License 2.0
245 stars 58 forks source link

coro-wrapper error #203

Closed ccinv closed 4 years ago

ccinv commented 7 years ago

I ran the example server and get such error

D:/proj/luvit.io/deps/coro-wrapper.lua:109: index must be a number if set stack traceback: [C]: in function 'assert' D:/proj/luvit.io/deps/coro-wrapper.lua:109: in function '(for generator)' D:/proj/luvit.io/deps/weblit-app.lua:121: in function <D:/proj/luvit.io/deps/weblit-app.lua:119> [C]: in function 'xpcall' D:/proj/luvit.io/deps/coro-net.lua:141: in function <D:/proj/luvit.io/deps/coro-net.lua:140>

Then I edited coro-wrapper.lua and deleted assert(type(newIndex) == "number", "index must be a number if set"), it works.Here newIndex is a string not number.

squeek502 commented 7 years ago

Could be related to/the same as https://github.com/luvit/lit/issues/200#issuecomment-277139210 if you're running it using luvit.

SinisterRectus commented 7 years ago

Not surprisingly, simply removing the assertion does not fix coro-http for me. It just allows for mismatched types to be used incorrectly:

coro-wrapper.lua:82: attempt to compare number with string

Definitely looks like the same issue.

creationix commented 7 years ago

For now you can't use the coro-* 3.x modules with luvit since it's internal http-codec overrides the 3.x one your app uses.

Luvi apps work great though if that's an option.

SinisterRectus commented 7 years ago

Should be fixed with luvit/luvit#980