From e12d6e44cd2c1e2f181a27e5c53c1265b7231c81 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Tue, 7 Jan 2014 17:52:51 -0800 Subject: [PATCH] fix(util/name): bug in Lua API Signed-off-by: Leonardo de Moura --- src/util/name.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/name.cpp b/src/util/name.cpp index b9a9127ad..8f6c2b749 100644 --- a/src/util/name.cpp +++ b/src/util/name.cpp @@ -508,14 +508,14 @@ static int name_get_prefix(lua_State * L) { } static int name_get_numeral(lua_State * L) { - if (to_name(L, 1).is_numeral()) + if (!to_name(L, 1).is_numeral()) throw exception("invalid get_numeral, hierarchical name with numeric head expected"); lua_pushinteger(L, to_name(L, 1).get_numeral()); return 1; } static int name_get_string(lua_State * L) { - if (to_name(L, 1).is_string()) + if (!to_name(L, 1).is_string()) throw exception("invalid get_string, hierarchical name with string head expected"); lua_pushstring(L, to_name(L, 1).get_string()); return 1;