From 5efce5b206ef2e795dc0b3c71464a1a3fce08d27 Mon Sep 17 00:00:00 2001 From: pixel Date: Thu, 31 Mar 2005 15:18:22 +0000 Subject: Hum... that tostring method still needs fixing... --- lib/BLua.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/BLua.cc b/lib/BLua.cc index 3ad95f7..e70902b 100644 --- a/lib/BLua.cc +++ b/lib/BLua.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: BLua.cc,v 1.30 2005-02-17 08:39:06 pixel Exp $ */ +/* $Id: BLua.cc,v 1.31 2005-03-31 15:18:22 pixel Exp $ */ #include #include "BLua.h" @@ -477,9 +477,15 @@ lua_Number Lua::tonumber(int i) { } String Lua::tostring(int i) { - if (isnil(i)) - return String(); - return String(lua_tostring(L, i)); + const char * r = 0; + if (isnil(i)) { + r = ""; + } else if (isboolean(i)) { + r = toboolean(i) ? "true" : "false"; + } else { + r = lua_tostring(L, i); + } + return String(r ? r : ""); } lua_CFunction Lua::tocfunction(int i) { -- cgit v1.2.3