From c3c1ab50646165c0e43784acb30a353dc5b40d12 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Mon, 6 Mar 2017 11:00:22 +0100 Subject: string.upper/lower --- src/lstrlib.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lstrlib.js b/src/lstrlib.js index 69f634d..96a33f5 100644 --- a/src/lstrlib.js +++ b/src/lstrlib.js @@ -25,9 +25,21 @@ const str_char = function(L) { return 1; }; +const str_lower = function(L) { + lapi.lua_pushstring(L, lauxlib.luaL_checkstring(L, 1).toLowerCase()); + return 1; +}; + +const str_upper = function(L) { + lapi.lua_pushstring(L, lauxlib.luaL_checkstring(L, 1).toUpperCase()); + return 1; +}; + const strlib = { - "len": str_len, - "char": str_char + "char": str_char, + "len": str_len, + "lower": str_lower, + "upper": str_upper }; const createmetatable = function(L) { -- cgit v1.2.3-70-g09d2