diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-10-26 10:47:05 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-10-26 10:47:05 -0200 |
| commit | b892f0a8774f573d7ec9b02617428871b8d3a2b3 (patch) | |
| tree | 4aab88443264d84d314ca663cf3c30b48c7e9107 /lmathlib.c | |
| parent | aadc35449ec2752c298a7a8fa6359a3a12c538ee (diff) | |
| download | lua-b892f0a8774f573d7ec9b02617428871b8d3a2b3.tar.gz lua-b892f0a8774f573d7ec9b02617428871b8d3a2b3.tar.bz2 lua-b892f0a8774f573d7ec9b02617428871b8d3a2b3.zip | |
new API function `createuserdata'
Diffstat (limited to 'lmathlib.c')
| -rw-r--r-- | lmathlib.c | 10 |
1 files changed, 5 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lmathlib.c,v 1.28 2000/08/31 20:23:40 roberto Exp roberto $ | 2 | ** $Id: lmathlib.c,v 1.29 2000/10/20 16:39:03 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 | */ |
| @@ -230,10 +230,10 @@ static const struct luaL_reg mathlib[] = { | |||
| 230 | */ | 230 | */ |
| 231 | LUA_API void lua_mathlibopen (lua_State *L) { | 231 | LUA_API void lua_mathlibopen (lua_State *L) { |
| 232 | luaL_openl(L, mathlib); | 232 | luaL_openl(L, mathlib); |
| 233 | lua_pushnumber(L, 0); /* to get its tag */ | ||
| 234 | lua_pushcfunction(L, math_pow); | 233 | lua_pushcfunction(L, math_pow); |
| 235 | lua_settagmethod(L, lua_tag(L, -2), "pow"); | 234 | lua_settagmethod(L, LUA_TNUMBER, "pow"); |
| 236 | lua_pop(L, 1); /* remove number */ | 235 | lua_pop(L, 1); /* remove result from previous call */ |
| 237 | lua_pushnumber(L, PI); lua_setglobal(L, "PI"); | 236 | lua_pushnumber(L, PI); |
| 237 | lua_setglobal(L, "PI"); | ||
| 238 | } | 238 | } |
| 239 | 239 | ||
