summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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) {