bit_div added

This commit is contained in:
p.kosyh@gmail.com 2011-04-28 19:37:57 +00:00
parent 250b16db54
commit f0c27411b8

View file

@ -1450,6 +1450,16 @@ static int luaB_bit_not(lua_State *L) {
return 1;
}
static int luaB_bit_div(lua_State *L) {
unsigned int a = luaL_optnumber(L, 1, 0);
unsigned int b = luaL_optnumber(L, 2, 1);
if (b) {
lua_pushnumber(L, a / b);
return 1;
}
return 0;
}
static const luaL_Reg base_funcs[] = {
{"doencfile", luaB_doencfile},
{"dofile", luaB_dofile},
@ -1497,6 +1507,8 @@ static const luaL_Reg base_funcs[] = {
{"bit_shl", luaB_bit_shl},
{"bit_shr", luaB_bit_shr},
{"bit_not", luaB_bit_not},
{"bit_div", luaB_bit_div},
{NULL, NULL}
};