diff options
| -rw-r--r-- | lmathlib.c | 4 | ||||
| -rw-r--r-- | lvm.c | 7 |
2 files changed, 5 insertions, 6 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lmathlib.c,v 1.54 2002/12/20 10:26:33 roberto Exp roberto $ | 2 | ** $Id: lmathlib.c,v 1.55 2003/03/11 12:24:34 roberto Exp roberto $ |
| 3 | ** Standard mathematical library | 3 | ** Standard mathematical library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -240,7 +240,7 @@ LUALIB_API int luaopen_math (lua_State *L) { | |||
| 240 | lua_settable(L, -3); | 240 | lua_settable(L, -3); |
| 241 | lua_pushliteral(L, "__pow"); | 241 | lua_pushliteral(L, "__pow"); |
| 242 | lua_pushcfunction(L, math_pow); | 242 | lua_pushcfunction(L, math_pow); |
| 243 | lua_settable(L, LUA_REGISTRYINDEX); | 243 | lua_settable(L, LUA_GLOBALSINDEX); |
| 244 | return 1; | 244 | return 1; |
| 245 | } | 245 | } |
| 246 | 246 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 1.280 2003/03/06 19:37:42 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.281 2003/03/07 13:21:31 roberto Exp roberto $ |
| 3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -357,11 +357,10 @@ static void Arith (lua_State *L, StkId ra, | |||
| 357 | case TM_MUL: setnvalue(ra, nvalue(b) * nvalue(c)); break; | 357 | case TM_MUL: setnvalue(ra, nvalue(b) * nvalue(c)); break; |
| 358 | case TM_DIV: setnvalue(ra, nvalue(b) / nvalue(c)); break; | 358 | case TM_DIV: setnvalue(ra, nvalue(b) / nvalue(c)); break; |
| 359 | case TM_POW: { | 359 | case TM_POW: { |
| 360 | const TObject *f = luaH_getstr(hvalue(registry(L)), | 360 | const TObject *f = luaH_getstr(hvalue(gt(L)), G(L)->tmname[TM_POW]); |
| 361 | G(L)->tmname[TM_POW]); | ||
| 362 | ptrdiff_t res = savestack(L, ra); | 361 | ptrdiff_t res = savestack(L, ra); |
| 363 | if (!ttisfunction(f)) | 362 | if (!ttisfunction(f)) |
| 364 | luaG_runerror(L, "`pow' (for `^' operator) is not a function"); | 363 | luaG_runerror(L, "`__pow' (`^' operator) is not a function"); |
| 365 | callTMres(L, f, b, c); | 364 | callTMres(L, f, b, c); |
| 366 | ra = restorestack(L, res); /* previous call may change stack */ | 365 | ra = restorestack(L, res); /* previous call may change stack */ |
| 367 | setobjs2s(ra, L->top); | 366 | setobjs2s(ra, L->top); |
