summaryrefslogtreecommitdiff
path: root/src/lbaselib.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-20 12:09:05 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-20 12:09:05 +0100
commit5860ec2bde3b220eff01b3bd1462e60905ef2fe9 (patch)
tree7002ef7a3417388c1077b6df34f14b8acb0bd34d /src/lbaselib.js
parent6d3d22b3938a811bdde9a311753837003df42d08 (diff)
downloadfengari-5860ec2bde3b220eff01b3bd1462e60905ef2fe9.tar.gz
fengari-5860ec2bde3b220eff01b3bd1462e60905ef2fe9.tar.bz2
fengari-5860ec2bde3b220eff01b3bd1462e60905ef2fe9.zip
type
Diffstat (limited to 'src/lbaselib.js')
-rw-r--r--src/lbaselib.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lbaselib.js b/src/lbaselib.js
index a89cf9d..db6e61d 100644
--- a/src/lbaselib.js
+++ b/src/lbaselib.js
@@ -81,6 +81,13 @@ const luaB_rawset = function(L) {
return 1;
};
+const luaB_type = function(L) {
+ let t = lapi.lua_type(L, 1);
+ lauxlib.luaL_argcheck(L, t != CT.LUA_TNONE, 1, "value expected");
+ lapi.lua_pushstring(L, lapi.lua_typename(L, t));
+ return 1;
+};
+
const base_funcs = {
"print": luaB_print,
"tostring": luaB_tostring,
@@ -89,6 +96,7 @@ const base_funcs = {
"rawequal": luaB_rawequal,
"rawset": luaB_rawset,
"rawget": luaB_rawget,
+ "type": luaB_type
};
const luaopen_base = function(L) {