diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-04-22 15:00:37 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-04-22 15:00:37 -0300 |
commit | 0ef5cf22891c9d34a88ccc5d89eb0ed82b004471 (patch) | |
tree | 1a095acefa978d5a41f32ff7d0fef58a642aa66c /mathlib.c | |
parent | fed9408ab51a4be5ff84450ad47d1e0cdaed97bc (diff) | |
download | lua-0ef5cf22891c9d34a88ccc5d89eb0ed82b004471.tar.gz lua-0ef5cf22891c9d34a88ccc5d89eb0ed82b004471.tar.bz2 lua-0ef5cf22891c9d34a88ccc5d89eb0ed82b004471.zip |
lock mechanism seperseded by the REFERENCE mechanism.
Diffstat (limited to 'mathlib.c')
-rw-r--r-- | mathlib.c | 8 |
1 files changed, 4 insertions, 4 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.13 1995/11/10 17:54:31 roberto Exp roberto $"; | 6 | char *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 | ||
107 | static int old_pow; | 107 | static lua_Reference old_pow; |
108 | 108 | ||
109 | static void math_pow (void) | 109 | static 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 | } |