aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-06 11:00:22 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-06 11:00:22 +0100
commitc3c1ab50646165c0e43784acb30a353dc5b40d12 (patch)
tree81d8a0941f67330fa872d19f017f414f99b0ee0d /src
parentd792a7dad54039074890d9d379eec8676cb9fa5a (diff)
downloadfengari-c3c1ab50646165c0e43784acb30a353dc5b40d12.tar.gz
fengari-c3c1ab50646165c0e43784acb30a353dc5b40d12.tar.bz2
fengari-c3c1ab50646165c0e43784acb30a353dc5b40d12.zip
string.upper/lower
Diffstat (limited to 'src')
-rw-r--r--src/lstrlib.js16
1 files changed, 14 insertions, 2 deletions
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) {