-
-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Register doesn't work #178
Comments
|
|
My naive approach: const luaZ_fill = function(z) {
let buff = from_userstring(z.reader(z.L, z.data));
if (buff === null)
return EOZ;
lua_assert(buff instanceof Uint8Array, "Should only load binary of array of bytes");
let size = buff.length;
if (size === 0)
return EOZ;
z.buffer = buff;
z.off = 0;
z.n = size - 1;
return z.buffer[z.off++];
}; Broke a lot of things, i assume that FAIL test/lcorolib.test.js
● coroutine.create, coroutine.yield, coroutine.resume
expect(received).toBe(expected) // Object.is equality
Expected: 0
Received: -1
24 | {
25 | lualib.luaL_openlibs(L);
> 26 | expect(lauxlib.luaL_loadstring(L, to_luastring(luaCode))).toBe(lua.LUA_OK);
| ^
27 | lua.lua_call(L, 0, -1);
28 | }
29 |
at Object.<anonymous> (test/lcorolib.test.js:26:67) Here's what I got:
It seems that a large number of tests convert strings to lua_strings before passing into loadstring, or dostring, etc. Maybe that was the way the creators intended? I was looking for something to fix, I don't think this is broken. |
I had something more like this in mind: const luaZ_fill = function(z) {
let buff = z.reader(z.L, z.data);
if (buff === null)
return EOZ;
buff = from_userstring(buff);
let size = buff.length;
if (size === 0)
return EOZ;
z.buffer = buff;
z.off = 0;
z.n = size - 1;
return z.buffer[z.off++];
};
Likely you forgot to import const { from_userstring } = require('./defs.js'); |
No, I'm not quite sure why my approach did not work, maybe the assert failed? Your solution works, I PR'd it. I will mention you, thanks. |
doesn't output anything
The text was updated successfully, but these errors were encountered: