#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>

int
lua_bitwise_or(lua_State *L)
{
	long a, b;
	
	a = luaL_checklong(L, 1);
	b = luaL_checklong(L, 2);
	lua_pushnumber(L, a | b);

	return(1);
}

int
lua_bitwise_and(lua_State *L)
{
	long a, b;
	
	a = luaL_checklong(L, 1);
	b = luaL_checklong(L, 2);
	lua_pushnumber(L, a & b);

	return(1);
}

LUA_API int
lua_bitwise_register(lua_State *L)
{
	lua_register(L, "bitwise_or",	lua_bitwise_or);
	lua_register(L, "bitwise_and",	lua_bitwise_and);
	return(1);
}
