aboutsummaryrefslogtreecommitdiff
path: root/mathlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-06-09 14:30:10 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-06-09 14:30:10 -0300
commit414ebe8ce1b0263b23e0d55b62cf23499f23548b (patch)
tree5600bc40c9193ac8f44142bc542373b563c0262a /mathlib.c
parent33ace03b5a1cde68445f5718ecc42619e46a6644 (diff)
downloadlua-414ebe8ce1b0263b23e0d55b62cf23499f23548b.tar.gz
lua-414ebe8ce1b0263b23e0d55b62cf23499f23548b.tar.bz2
lua-414ebe8ce1b0263b23e0d55b62cf23499f23548b.zip
power method (^) acts only in numbers.
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 1774f7aa..17e301da 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.22 1997/04/04 22:24:51 roberto Exp roberto $"; 6char *rcs_mathlib="$Id: mathlib.c,v 1.23 1997/04/06 14:08:08 roberto Exp roberto $";
7 7
8#include <stdlib.h> 8#include <stdlib.h>
9#include <math.h> 9#include <math.h>
@@ -210,6 +210,7 @@ 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_settagmethod(0, "pow", math_pow); 213 lua_pushnumber(0); /* to get its tag */
214 lua_settagmethod(lua_tag(lua_pop()), "pow", math_pow);
214} 215}
215 216