lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 84ad1eea8165e29e097bb3acd5b262250b551ac4
parent b30ec2532c27c572e4fc0da61c8227f8f9e7be7b
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Tue,  2 Jul 2002 14:54:01 -0300

use of NaN as key breaks some invariants

Diffstat:
Mltable.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ltable.c b/ltable.c @@ -1,5 +1,5 @@ /* -** $Id: ltable.c,v 1.111 2002/06/24 20:18:38 roberto Exp roberto $ +** $Id: ltable.c,v 1.112 2002/07/01 19:31:10 roberto Exp roberto $ ** Lua tables (hash) ** See Copyright Notice in lua.h */ @@ -468,6 +468,8 @@ TObject *luaH_set (lua_State *L, Table *t, const TObject *key) { return cast(TObject *, p); else { if (ttype(key) == LUA_TNIL) luaG_runerror(L, "table index is nil"); + else if (ttype(key) == LUA_TNUMBER && nvalue(key) != nvalue(key)) + luaG_runerror(L, "table index is NaN"); return newkey(L, t, key); } }