aboutsummaryrefslogtreecommitdiff
path: root/ldblib.c
diff options
context:
space:
mode:
Diffstat (limited to 'ldblib.c')
-rw-r--r--ldblib.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/ldblib.c b/ldblib.c
index 85239d7b..0e761aee 100644
--- a/ldblib.c
+++ b/ldblib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldblib.c,v 1.131 2011/10/24 14:54:05 roberto Exp roberto $ 2** $Id: ldblib.c,v 1.132 2012/01/19 20:14:44 roberto Exp roberto $
3** Interface from Lua to its debug API 3** Interface from Lua to its debug API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -22,6 +22,18 @@
22 22
23 23
24 24
25static int db_numbits (lua_State *L) {
26 const char *s = luaL_checkstring(L, 1);
27 if (*s == 'i')
28 lua_pushinteger(L, sizeof(lua_Integer) * CHAR_BIT);
29 else if (*s == 'f')
30 lua_pushinteger(L, sizeof(lua_Number) * CHAR_BIT);
31 else
32 luaL_argerror(L, 1, lua_pushfstring(L, "invalid option '%s'", s));
33 return 1;
34}
35
36
25static int db_getregistry (lua_State *L) { 37static int db_getregistry (lua_State *L) {
26 lua_pushvalue(L, LUA_REGISTRYINDEX); 38 lua_pushvalue(L, LUA_REGISTRYINDEX);
27 return 1; 39 return 1;
@@ -379,6 +391,7 @@ static const luaL_Reg dblib[] = {
379 {"getregistry", db_getregistry}, 391 {"getregistry", db_getregistry},
380 {"getmetatable", db_getmetatable}, 392 {"getmetatable", db_getmetatable},
381 {"getupvalue", db_getupvalue}, 393 {"getupvalue", db_getupvalue},
394 {"numbits", db_numbits},
382 {"upvaluejoin", db_upvaluejoin}, 395 {"upvaluejoin", db_upvaluejoin},
383 {"upvalueid", db_upvalueid}, 396 {"upvalueid", db_upvalueid},
384 {"setuservalue", db_setuservalue}, 397 {"setuservalue", db_setuservalue},