mirror of
https://github.com/lua/lua
synced 2025-01-24 18:12:11 +03:00
power method (^) acts only in numbers.
This commit is contained in:
parent
33ace03b5a
commit
414ebe8ce1
@ -3,7 +3,7 @@
|
||||
** Mathematics library to LUA
|
||||
*/
|
||||
|
||||
char *rcs_mathlib="$Id: mathlib.c,v 1.22 1997/04/04 22:24:51 roberto Exp roberto $";
|
||||
char *rcs_mathlib="$Id: mathlib.c,v 1.23 1997/04/06 14:08:08 roberto Exp roberto $";
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
@ -210,6 +210,7 @@ static struct luaL_reg mathlib[] = {
|
||||
void mathlib_open (void)
|
||||
{
|
||||
luaL_openlib(mathlib, (sizeof(mathlib)/sizeof(mathlib[0])));
|
||||
lua_settagmethod(0, "pow", math_pow);
|
||||
lua_pushnumber(0); /* to get its tag */
|
||||
lua_settagmethod(lua_tag(lua_pop()), "pow", math_pow);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user