diff options
author | daurnimator <quae@daurnimator.com> | 2017-05-05 10:33:23 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-05-05 10:33:23 +1000 |
commit | b600ba0123b8af27d2d25e7655b311163afaec91 (patch) | |
tree | 082377211fe92fdd2e60c521aecaf0ad2cd64f6f /src/liolib.js | |
parent | 84a0982085967895e9bb5e5439c09960840da2d5 (diff) | |
download | fengari-b600ba0123b8af27d2d25e7655b311163afaec91.tar.gz fengari-b600ba0123b8af27d2d25e7655b311163afaec91.tar.bz2 fengari-b600ba0123b8af27d2d25e7655b311163afaec91.zip |
Fix luaL_error callsites
- Now that luaL_error does sprintf-like formatting it shouldn't take user input
- % now needs to be escaped when passed to luaL_error
- Removes several wasteful lua->js->lua string transformations
Diffstat (limited to 'src/liolib.js')
-rw-r--r-- | src/liolib.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/liolib.js b/src/liolib.js index 2136755..1557adf 100644 --- a/src/liolib.js +++ b/src/liolib.js @@ -31,7 +31,7 @@ const f_tostring = function(L) { const tofile = function(L) { let p = tolstream(L); if (isclosed(p)) - lauxlib.luaL_error(L, "attempt to use a closed file"); + lauxlib.luaL_error(L, lua.to_luastring("attempt to use a closed file")); assert(p.f); return p.f; }; @@ -62,7 +62,7 @@ const getiofile = function(L, findex) { lua.lua_getfield(L, lua.LUA_REGISTRYINDEX, findex); let p = lua.lua_touserdata(L, -1); if (isclosed(p)) - lauxlib.luaL_error(L, lua.to_luastring(`standard ${lua.to_jsstring(findex.slice(IOPREF_LEN))} file is closed`)); + lauxlib.luaL_error(L, lua.to_luastring("standard %s file is closed"), findex.slice(IOPREF_LEN)); return p.f; }; |