aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ldblib.c15
-rw-r--r--lmathlib.c15
2 files changed, 15 insertions, 15 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},
diff --git a/lmathlib.c b/lmathlib.c
index aa3fc550..26e40b8d 100644
--- a/lmathlib.c
+++ b/lmathlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lmathlib.c,v 1.87 2013/06/13 19:32:52 roberto Exp roberto $ 2** $Id: lmathlib.c,v 1.88 2013/06/25 14:02:18 roberto Exp roberto $
3** Standard mathematical library 3** Standard mathematical library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -246,18 +246,6 @@ static int math_isfloat (lua_State *L) {
246} 246}
247 247
248 248
249static int math_numbits (lua_State *L) {
250 const char *s = luaL_checkstring(L, 1);
251 if (*s == 'i')
252 lua_pushinteger(L, sizeof(lua_Integer) * CHAR_BIT);
253 else if (*s == 'f')
254 lua_pushinteger(L, sizeof(lua_Number) * CHAR_BIT);
255 else
256 luaL_argerror(L, 1, lua_pushfstring(L, "invalid option '%s'", s));
257 return 1;
258}
259
260
261static const luaL_Reg mathlib[] = { 249static const luaL_Reg mathlib[] = {
262 {"abs", math_abs}, 250 {"abs", math_abs},
263 {"acos", math_acos}, 251 {"acos", math_acos},
@@ -287,7 +275,6 @@ static const luaL_Reg mathlib[] = {
287 {"randomseed", math_randomseed}, 275 {"randomseed", math_randomseed},
288 {"sinh", math_sinh}, 276 {"sinh", math_sinh},
289 {"sin", math_sin}, 277 {"sin", math_sin},
290 {"numbits", math_numbits},
291 {"sqrt", math_sqrt}, 278 {"sqrt", math_sqrt},
292 {"tanh", math_tanh}, 279 {"tanh", math_tanh},
293 {"tan", math_tan}, 280 {"tan", math_tan},