open functions are lua_Cfunctions

This commit is contained in:
Roberto Ierusalimschy
2001-03-06 17:09:38 -03:00
parent e9a3820370
commit 6d4db86888
7 changed files with 42 additions and 32 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lmathlib.c,v 1.35 2001/02/22 18:59:59 roberto Exp roberto $
** $Id: lmathlib.c,v 1.36 2001/02/23 17:17:25 roberto Exp roberto $
** Standard mathematical library
** See Copyright Notice in lua.h
*/
@@ -228,11 +228,12 @@ static const luaL_reg mathlib[] = {
/*
** Open math library
*/
LUALIB_API void lua_mathlibopen (lua_State *L) {
LUALIB_API int lua_mathlibopen (lua_State *L) {
luaL_openl(L, mathlib);
lua_pushcfunction(L, math_pow);
lua_settagmethod(L, LUA_TNUMBER, l_s("pow"));
lua_pushnumber(L, PI);
lua_setglobal(L, l_s("PI"));
return 0;
}