From 34ac039fb84e3c12fb8c96c9c99c34224c09872b Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 30 Jul 2014 11:00:14 -0300 Subject: new macro 'cvt2str' to better control whether numbers are convertible to strings --- lvm.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lvm.h') diff --git a/lvm.h b/lvm.h index 6dff8b1e..0a4984cb 100644 --- a/lvm.h +++ b/lvm.h @@ -1,5 +1,5 @@ /* -** $Id: lvm.h,v 2.30 2014/05/12 21:22:05 roberto Exp roberto $ +** $Id: lvm.h,v 2.31 2014/05/26 17:10:22 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -24,12 +24,18 @@ #define luaV_rawequalobj(t1,t2) luaV_equalobj(NULL,t1,t2) +#if !defined(LUA_NOCVTN2S) +#define cvt2str(o) ttisnumber(o) +#else +#define cvt2str(o) 0 /* no convertion from numbers to strings */ +#endif + + LUAI_FUNC int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2); LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); LUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r); LUAI_FUNC int luaV_tonumber_ (const TValue *obj, lua_Number *n); LUAI_FUNC int luaV_tointeger_ (const TValue *obj, lua_Integer *p); -LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val); LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, -- cgit v1.2.3-55-g6feb