summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorpixel <pixel>2005-03-31 15:18:22 +0000
committerpixel <pixel>2005-03-31 15:18:22 +0000
commit5efce5b206ef2e795dc0b3c71464a1a3fce08d27 (patch)
treec8d71fa54831e26cefcfb8c8c378785cfbe5f16c /lib
parentfae7028e83b317caffbb03bcfaa181e7f6862b4a (diff)
Hum... that tostring method still needs fixing...
Diffstat (limited to 'lib')
-rw-r--r--lib/BLua.cc14
1 files changed, 10 insertions, 4 deletions
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 <stdlib.h>
#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-NULL>");
}
lua_CFunction Lua::tocfunction(int i) {