diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-24 10:54:13 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-24 10:54:13 -0300 |
commit | e182cf452fca5e00c6bd6a63642ce3ef8d7f7a53 (patch) | |
tree | 4a07ae322f223fb947f7ff32ae3c71ae8f7c50d6 | |
parent | e34f282365d72ddbd2000f789cd804dbbd433773 (diff) | |
download | lua-e182cf452fca5e00c6bd6a63642ce3ef8d7f7a53.tar.gz lua-e182cf452fca5e00c6bd6a63642ce3ef8d7f7a53.tar.bz2 lua-e182cf452fca5e00c6bd6a63642ce3ef8d7f7a53.zip |
`^' operator is defined in registry.__pow
-rw-r--r-- | lmathlib.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmathlib.c,v 1.46 2002/06/05 17:24:04 roberto Exp roberto $ | 2 | ** $Id: lmathlib.c,v 1.47 2002/06/18 15:16:18 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 | */ |
@@ -220,6 +220,7 @@ static const luaL_reg mathlib[] = { | |||
220 | {"log10", math_log10}, | 220 | {"log10", math_log10}, |
221 | {"exp", math_exp}, | 221 | {"exp", math_exp}, |
222 | {"deg", math_deg}, | 222 | {"deg", math_deg}, |
223 | {"pow", math_pow}, | ||
223 | {"rad", math_rad}, | 224 | {"rad", math_rad}, |
224 | {"random", math_random}, | 225 | {"random", math_random}, |
225 | {"randomseed", math_randomseed}, | 226 | {"randomseed", math_randomseed}, |
@@ -236,9 +237,11 @@ LUALIB_API int lua_mathlibopen (lua_State *L) { | |||
236 | luaL_openlib(L, mathlib, 0); | 237 | luaL_openlib(L, mathlib, 0); |
237 | lua_pushliteral(L, "pi"); | 238 | lua_pushliteral(L, "pi"); |
238 | lua_pushnumber(L, PI); | 239 | lua_pushnumber(L, PI); |
239 | lua_register(L, "pow", math_pow); | ||
240 | lua_settable(L, -3); | 240 | lua_settable(L, -3); |
241 | lua_settable(L, LUA_GLOBALSINDEX); | 241 | lua_settable(L, LUA_GLOBALSINDEX); |
242 | lua_pushliteral(L, "__pow"); | ||
243 | lua_pushcfunction(L, math_pow); | ||
244 | lua_settable(L, LUA_REGISTRYINDEX); | ||
242 | return 0; | 245 | return 0; |
243 | } | 246 | } |
244 | 247 | ||