Skip to content

v0.5.1 - TypeScript declarations, vm.protect, lua2js comment fix

Choose a tag to compare

@datamoc datamoc released this 11 Oct 06:02
· 42 commits to master since this release

Security fix (lua2js): a Lua line comment containing a bare CR, U+2028 or U+2029 ended the generated // comment early, so the rest of the comment ran as JavaScript. Those characters are now replaced by spaces. If you translated untrusted Lua with 0.5.0, review the comments in the output.

New:

  • TypeScript declarations (src/fengari.d.ts, "types" in package.json) for FengariVm, LuaRef, LuaError, LimitError, Coroutine, Userdata, LuaFloat, the options and the lua2js result. The C-API namespaces are typed any for now.
  • vm.throwLuaError(L, index = -1): throws the Lua error value at index as a LuaError (LimitError after a limit overrun).
  • vm.protect(fn): runs a host callback in a Lua protected call, so Lua errors raised through the C API become LuaError / LimitError and the stack is restored.

See CHANGES.md for details.