diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-06-19 15:03:04 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-06-19 15:03:04 -0300 |
commit | 88f020b626d1b5b10b5d12e04bf103409a5e4308 (patch) | |
tree | e8d65e90ce914acebbd74c528b660db21ef27084 /mathlib.c | |
parent | a38f093f0540bce0207bb2dc27f1779f41c6d48b (diff) | |
download | lua-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.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -3,7 +3,7 @@ | |||
3 | ** Mathematics library to LUA | 3 | ** Mathematics library to LUA |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_mathlib="$Id: mathlib.c,v 1.23 1997/04/06 14:08:08 roberto Exp roberto $"; | 6 | char *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[] = { | |||
210 | void mathlib_open (void) | 210 | void 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 | ||