aboutsummaryrefslogtreecommitdiff
path: root/lmathlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-10-10 09:57:55 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-10-10 09:57:55 -0300
commit533737f26e3f8036d7978e09427ea5ff75aec9df (patch)
tree003004a423cf20bc4e1493918760494b0d694f93 /lmathlib.c
parenta41d60e1d1f3a954648884d4ab7fb7e9ccdd52d6 (diff)
downloadlua-533737f26e3f8036d7978e09427ea5ff75aec9df.tar.gz
lua-533737f26e3f8036d7978e09427ea5ff75aec9df.tar.bz2
lua-533737f26e3f8036d7978e09427ea5ff75aec9df.zip
new functions `lua_getfield' and `lua_setfield'
Diffstat (limited to 'lmathlib.c')
-rw-r--r--lmathlib.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/lmathlib.c b/lmathlib.c
index 6afbcab6..c9397376 100644
--- a/lmathlib.c
+++ b/lmathlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lmathlib.c,v 1.56 2003/03/11 12:30:37 roberto Exp roberto $ 2** $Id: lmathlib.c,v 1.57 2003/10/07 20:13:41 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*/
@@ -235,12 +235,10 @@ static const luaL_reg mathlib[] = {
235*/ 235*/
236LUALIB_API int luaopen_math (lua_State *L) { 236LUALIB_API int luaopen_math (lua_State *L) {
237 luaL_openlib(L, LUA_MATHLIBNAME, mathlib, 0); 237 luaL_openlib(L, LUA_MATHLIBNAME, mathlib, 0);
238 lua_pushliteral(L, "pi");
239 lua_pushnumber(L, PI); 238 lua_pushnumber(L, PI);
240 lua_settable(L, -3); 239 lua_setfield(L, -2, "pi");
241 lua_pushliteral(L, "__pow");
242 lua_pushcfunction(L, math_pow); 240 lua_pushcfunction(L, math_pow);
243 lua_settable(L, LUA_GLOBALSINDEX); 241 lua_setfield(L, LUA_GLOBALSINDEX, "__pow");
244 return 1; 242 return 1;
245} 243}
246 244