diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-03-18 12:30:50 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-03-18 12:30:50 -0300 |
| commit | 2de803c250de373186afbbea0a5978f54c52850c (patch) | |
| tree | a00499eac71bb427fd720e45bdfa2749dd134b51 /mathlib.c | |
| parent | fa08b42dd851ae945df9796438ac0565939a00f2 (diff) | |
| download | lua-2de803c250de373186afbbea0a5978f54c52850c.tar.gz lua-2de803c250de373186afbbea0a5978f54c52850c.tar.bz2 lua-2de803c250de373186afbbea0a5978f54c52850c.zip | |
new header 'auxlib.h' + new function luaL_verror
Diffstat (limited to '')
| -rw-r--r-- | mathlib.c | 7 |
1 files changed, 4 insertions, 3 deletions
| @@ -3,12 +3,13 @@ | |||
| 3 | ** Mathematics library to LUA | 3 | ** Mathematics library to LUA |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | char *rcs_mathlib="$Id: mathlib.c,v 1.18 1996/08/01 14:55:33 roberto Exp roberto $"; | 6 | char *rcs_mathlib="$Id: mathlib.c,v 1.19 1997/03/17 17:01:10 roberto Exp roberto $"; |
| 7 | 7 | ||
| 8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
| 9 | #include <math.h> | 9 | #include <math.h> |
| 10 | 10 | ||
| 11 | #include "lualib.h" | 11 | #include "lualib.h" |
| 12 | #include "auxlib.h" | ||
| 12 | #include "lua.h" | 13 | #include "lua.h" |
| 13 | 14 | ||
| 14 | #ifndef PI | 15 | #ifndef PI |
| @@ -195,7 +196,7 @@ static void math_randomseed (void) | |||
| 195 | } | 196 | } |
| 196 | 197 | ||
| 197 | 198 | ||
| 198 | static struct lua_reg mathlib[] = { | 199 | static struct luaL_reg mathlib[] = { |
| 199 | {"abs", math_abs}, | 200 | {"abs", math_abs}, |
| 200 | {"sin", math_sin}, | 201 | {"sin", math_sin}, |
| 201 | {"cos", math_cos}, | 202 | {"cos", math_cos}, |
| @@ -224,7 +225,7 @@ static struct lua_reg mathlib[] = { | |||
| 224 | */ | 225 | */ |
| 225 | void mathlib_open (void) | 226 | void mathlib_open (void) |
| 226 | { | 227 | { |
| 227 | luaI_openlib(mathlib, (sizeof(mathlib)/sizeof(mathlib[0]))); | 228 | luaL_openlib(mathlib, (sizeof(mathlib)/sizeof(mathlib[0]))); |
| 228 | old_pow = lua_refobject(lua_setfallback("arith", math_pow), 1); | 229 | old_pow = lua_refobject(lua_setfallback("arith", math_pow), 1); |
| 229 | } | 230 | } |
| 230 | 231 | ||
