diff options
author | daurnimator <quae@daurnimator.com> | 2017-12-13 16:51:04 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-12-13 16:51:04 +1100 |
commit | 60181181128144f483bbf344ef51b2ce5385a3c0 (patch) | |
tree | 2d1714260afa7d1bedc44a5826dccc6fb364ced6 | |
parent | 17e4cff6514c75920462397c227408c21336d1ae (diff) | |
download | fengari-60181181128144f483bbf344ef51b2ce5385a3c0.tar.gz fengari-60181181128144f483bbf344ef51b2ce5385a3c0.tar.bz2 fengari-60181181128144f483bbf344ef51b2ce5385a3c0.zip |
README.md: Mention strings are backed by Uint8Array
-rw-r--r-- | README.md | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -45,7 +45,7 @@ Fengari implements Lua 5.3 semantics and will hopefully follow future Lua releas Lua strings are 8-bits clean and can embed `\0`. Which means that invalid UTF-8/16 strings are valid Lua strings. Lua functions like `string.dump` even use strings as a way of storing binary data. -To address that issue, Lua strings are represented by an array of bytes in Fengari. To push a JS string on the stack you can use `lua_pushliteral` which will convert it to an array of bytes before pushing it. To get a Lua string on the stack as a JS string you can use `lua_tojsstring` which will attempt to convert it to a UTF-16 JS string. The latter won't give you what you expect if the Lua string is not a valid UTF-16 sequence. You can also convert strings with `lua.to_luastring`, `lua.to_jsstring` and `lua.to_uristring`. +To address that issue, Fengari uses [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) objects containing the raw bytes to implement lua strings. To push a JS string on the stack you can use `lua_pushliteral` which will convert it to an array of bytes before pushing it. To get a Lua string on the stack as a JS string you can use `lua_tojsstring` which will attempt to convert it to a UTF-16 JS string. The latter won't give you what you expect if the Lua string is not a valid UTF-16 sequence. You can also convert strings with `lua.to_luastring`, `lua.to_jsstring` and `lua.to_uristring`. ### Integers |