summaryrefslogtreecommitdiff
path: root/src/lstrlib.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-11-12 20:41:39 +1100
committerdaurnimator <quae@daurnimator.com>2017-11-12 20:41:39 +1100
commit57027388763058b030a91e82d7cbfe04153aa38c (patch)
treedd01f710326ff935896b2b85cb00c7cd32390b3e /src/lstrlib.js
parentfadf3105964c5c65f06e9c561f4872be810080a9 (diff)
downloadfengari-57027388763058b030a91e82d7cbfe04153aa38c.tar.gz
fengari-57027388763058b030a91e82d7cbfe04153aa38c.tar.bz2
fengari-57027388763058b030a91e82d7cbfe04153aa38c.zip
src/lstrlib.js: Move arg checking to own line
Diffstat (limited to 'src/lstrlib.js')
-rw-r--r--src/lstrlib.js6
1 files changed, 4 insertions, 2 deletions
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;
};