'numbits' moved from 'math' to 'debug' library
This commit is contained in:
15
ldblib.c
15
ldblib.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: ldblib.c,v 1.131 2011/10/24 14:54:05 roberto Exp roberto $
|
** $Id: ldblib.c,v 1.132 2012/01/19 20:14:44 roberto Exp roberto $
|
||||||
** Interface from Lua to its debug API
|
** Interface from Lua to its debug API
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -22,6 +22,18 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int db_numbits (lua_State *L) {
|
||||||
|
const char *s = luaL_checkstring(L, 1);
|
||||||
|
if (*s == 'i')
|
||||||
|
lua_pushinteger(L, sizeof(lua_Integer) * CHAR_BIT);
|
||||||
|
else if (*s == 'f')
|
||||||
|
lua_pushinteger(L, sizeof(lua_Number) * CHAR_BIT);
|
||||||
|
else
|
||||||
|
luaL_argerror(L, 1, lua_pushfstring(L, "invalid option '%s'", s));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int db_getregistry (lua_State *L) {
|
static int db_getregistry (lua_State *L) {
|
||||||
lua_pushvalue(L, LUA_REGISTRYINDEX);
|
lua_pushvalue(L, LUA_REGISTRYINDEX);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -379,6 +391,7 @@ static const luaL_Reg dblib[] = {
|
|||||||
{"getregistry", db_getregistry},
|
{"getregistry", db_getregistry},
|
||||||
{"getmetatable", db_getmetatable},
|
{"getmetatable", db_getmetatable},
|
||||||
{"getupvalue", db_getupvalue},
|
{"getupvalue", db_getupvalue},
|
||||||
|
{"numbits", db_numbits},
|
||||||
{"upvaluejoin", db_upvaluejoin},
|
{"upvaluejoin", db_upvaluejoin},
|
||||||
{"upvalueid", db_upvalueid},
|
{"upvalueid", db_upvalueid},
|
||||||
{"setuservalue", db_setuservalue},
|
{"setuservalue", db_setuservalue},
|
||||||
|
|||||||
15
lmathlib.c
15
lmathlib.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lmathlib.c,v 1.87 2013/06/13 19:32:52 roberto Exp roberto $
|
** $Id: lmathlib.c,v 1.88 2013/06/25 14:02:18 roberto Exp roberto $
|
||||||
** Standard mathematical library
|
** Standard mathematical library
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -246,18 +246,6 @@ static int math_isfloat (lua_State *L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int math_numbits (lua_State *L) {
|
|
||||||
const char *s = luaL_checkstring(L, 1);
|
|
||||||
if (*s == 'i')
|
|
||||||
lua_pushinteger(L, sizeof(lua_Integer) * CHAR_BIT);
|
|
||||||
else if (*s == 'f')
|
|
||||||
lua_pushinteger(L, sizeof(lua_Number) * CHAR_BIT);
|
|
||||||
else
|
|
||||||
luaL_argerror(L, 1, lua_pushfstring(L, "invalid option '%s'", s));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static const luaL_Reg mathlib[] = {
|
static const luaL_Reg mathlib[] = {
|
||||||
{"abs", math_abs},
|
{"abs", math_abs},
|
||||||
{"acos", math_acos},
|
{"acos", math_acos},
|
||||||
@@ -287,7 +275,6 @@ static const luaL_Reg mathlib[] = {
|
|||||||
{"randomseed", math_randomseed},
|
{"randomseed", math_randomseed},
|
||||||
{"sinh", math_sinh},
|
{"sinh", math_sinh},
|
||||||
{"sin", math_sin},
|
{"sin", math_sin},
|
||||||
{"numbits", math_numbits},
|
|
||||||
{"sqrt", math_sqrt},
|
{"sqrt", math_sqrt},
|
||||||
{"tanh", math_tanh},
|
{"tanh", math_tanh},
|
||||||
{"tan", math_tan},
|
{"tan", math_tan},
|
||||||
|
|||||||
Reference in New Issue
Block a user