aboutsummaryrefslogtreecommitdiff
path: root/mathlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-06-19 15:03:04 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-06-19 15:03:04 -0300
commit88f020b626d1b5b10b5d12e04bf103409a5e4308 (patch)
treee8d65e90ce914acebbd74c528b660db21ef27084 /mathlib.c
parenta38f093f0540bce0207bb2dc27f1779f41c6d48b (diff)
downloadlua-88f020b626d1b5b10b5d12e04bf103409a5e4308.tar.gz
lua-88f020b626d1b5b10b5d12e04bf103409a5e4308.tar.bz2
lua-88f020b626d1b5b10b5d12e04bf103409a5e4308.zip
new interface to "lua_seterrormethod" and "lua_settagmethod", to
allow the use of Lua functions too.
Diffstat (limited to 'mathlib.c')
-rw-r--r--mathlib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mathlib.c b/mathlib.c
index 17e301da..bb33db08 100644
--- a/mathlib.c
+++ b/mathlib.c
@@ -3,7 +3,7 @@
3** Mathematics library to LUA 3** Mathematics library to LUA
4*/ 4*/
5 5
6char *rcs_mathlib="$Id: mathlib.c,v 1.23 1997/04/06 14:08:08 roberto Exp roberto $"; 6char *rcs_mathlib="$Id: mathlib.c,v 1.24 1997/06/09 17:30:10 roberto Exp roberto $";
7 7
8#include <stdlib.h> 8#include <stdlib.h>
9#include <math.h> 9#include <math.h>
@@ -210,7 +210,8 @@ static struct luaL_reg mathlib[] = {
210void mathlib_open (void) 210void mathlib_open (void)
211{ 211{
212 luaL_openlib(mathlib, (sizeof(mathlib)/sizeof(mathlib[0]))); 212 luaL_openlib(mathlib, (sizeof(mathlib)/sizeof(mathlib[0])));
213 lua_pushcfunction(math_pow);
213 lua_pushnumber(0); /* to get its tag */ 214 lua_pushnumber(0); /* to get its tag */
214 lua_settagmethod(lua_tag(lua_pop()), "pow", math_pow); 215 lua_settagmethod(lua_tag(lua_pop()), "pow");
215} 216}
216 217