From 57027388763058b030a91e82d7cbfe04153aa38c Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sun, 12 Nov 2017 20:41:39 +1100 Subject: src/lstrlib.js: Move arg checking to own line --- src/lstrlib.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lstrlib.js b/src/lstrlib.js index 17ee999..80a5f55 100644 --- a/src/lstrlib.js +++ b/src/lstrlib.js @@ -640,14 +640,16 @@ const str_reverse = function(L) { }; const str_lower = function(L) { + let s = lauxlib.luaL_checkstring(L, 1); // TODO: will fail on invalid UTF-8 - lua.lua_pushstring(L, lua.to_luastring(lua.to_jsstring(lauxlib.luaL_checkstring(L, 1)).toLowerCase())); + lua.lua_pushstring(L, lua.to_luastring(lua.to_jsstring(s).toLowerCase())); return 1; }; const str_upper = function(L) { + let s = lauxlib.luaL_checkstring(L, 1); // TODO: will fail on invalid UTF-8 - lua.lua_pushstring(L, lua.to_luastring(lua.to_jsstring(lauxlib.luaL_checkstring(L, 1)).toUpperCase())); + lua.lua_pushstring(L, lua.to_luastring(lua.to_jsstring(s).toUpperCase())); return 1; }; -- cgit v1.2.3-70-g09d2