aboutsummaryrefslogtreecommitdiff
path: root/mathlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'mathlib.c')
-rw-r--r--mathlib.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/mathlib.c b/mathlib.c
index cf5b6a8a..efc887b8 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.13 1995/11/10 17:54:31 roberto Exp roberto $"; 6char *rcs_mathlib="$Id: mathlib.c,v 1.14 1996/02/09 17:21:27 roberto Exp roberto $";
7 7
8#include <stdlib.h> 8#include <stdlib.h>
9#include <math.h> 9#include <math.h>
@@ -104,7 +104,7 @@ static void math_sqrt (void)
104 lua_pushnumber (sqrt(d)); 104 lua_pushnumber (sqrt(d));
105} 105}
106 106
107static int old_pow; 107static lua_Reference old_pow;
108 108
109static void math_pow (void) 109static void math_pow (void)
110{ 110{
@@ -113,7 +113,7 @@ static void math_pow (void)
113 lua_Object op = lua_getparam(3); 113 lua_Object op = lua_getparam(3);
114 if (!lua_isnumber(o1) || !lua_isnumber(o2) || *(lua_getstring(op)) != 'p') 114 if (!lua_isnumber(o1) || !lua_isnumber(o2) || *(lua_getstring(op)) != 'p')
115 { 115 {
116 lua_Object old = lua_getlocked(old_pow); 116 lua_Object old = lua_getref(old_pow);
117 lua_pushobject(o1); 117 lua_pushobject(o1);
118 lua_pushobject(o2); 118 lua_pushobject(o2);
119 lua_pushobject(op); 119 lua_pushobject(op);
@@ -223,5 +223,5 @@ void mathlib_open (void)
223 lua_register ("random", math_random); 223 lua_register ("random", math_random);
224 lua_register ("randomseed", math_randomseed); 224 lua_register ("randomseed", math_randomseed);
225 225
226 old_pow = lua_lockobject(lua_setfallback("arith", math_pow)); 226 old_pow = lua_refobject(lua_setfallback("arith", math_pow), 1);
227} 227}