diff options
author | daurnimator <quae@daurnimator.com> | 2017-05-04 16:20:15 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-05-04 16:20:15 +1000 |
commit | 42820bafe8433cbba4158ea7a2e11f40e9d2c635 (patch) | |
tree | 4565113c036c830aa9681be59c13ee64ceba05b7 /src/lauxlib.js | |
parent | 0bd95f16e2af2028f0a5c9b41478bca74f16cc99 (diff) | |
download | fengari-42820bafe8433cbba4158ea7a2e11f40e9d2c635.tar.gz fengari-42820bafe8433cbba4158ea7a2e11f40e9d2c635.tar.bz2 fengari-42820bafe8433cbba4158ea7a2e11f40e9d2c635.zip |
src/lauxlib.js: Use lua_pushvfstring
Diffstat (limited to 'src/lauxlib.js')
-rw-r--r-- | src/lauxlib.js | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js index ff8a500..d9846c8 100644 --- a/src/lauxlib.js +++ b/src/lauxlib.js @@ -183,18 +183,10 @@ const luaL_where = function(L, level) { lua.lua_pushstring(L, []); }; -const luaL_error = function(L, fmt, ...args) { - let i = 0; - - fmt = lua.to_jsstring(fmt); - // TODO: bypassing lua_pushvstring for now - fmt = fmt.replace(/(^%[sfIpdcU]|([^%])%[sfIpdcU])/g, function (m, p1, p2, off) { - return p2 ? p2 + args[i++] : args[i++]; - }); - fmt = lua.to_luastring(fmt); - - lua.lua_pushstring(L, fmt); - +const luaL_error = function(L, fmt, ...argp) { + luaL_where(L, 1); + lua.lua_pushvfstring(L, fmt, argp); + lua.lua_concat(L, 2); return lua.lua_error(L); }; |