diff options
author | Artem Serebriyskiy <v.for.vandal@gmail.com> | 2014-03-23 14:05:05 +0400 |
---|---|---|
committer | Artem Serebriyskiy <v.for.vandal@gmail.com> | 2014-03-23 14:05:05 +0400 |
commit | f2c410a8c0c2646a715503a1beda3b4fc0ccf14a (patch) | |
tree | 2906c95653a5d4f01a658f0f2ae3f7139c2c494f | |
parent | 9df37fa15a5f5aea4dce15c1180a3261d153492e (diff) | |
download | swig-f2c410a8c0c2646a715503a1beda3b4fc0ccf14a.tar.gz |
Fixing issue 152
-rw-r--r-- | Examples/test-suite/lua/cpp_basic_runme.lua | 3 | ||||
-rw-r--r-- | Lib/lua/luarun.swg | 7 |
2 files changed, 5 insertions, 5 deletions
diff --git a/Examples/test-suite/lua/cpp_basic_runme.lua b/Examples/test-suite/lua/cpp_basic_runme.lua index 3e2fb963e..8a72f1bad 100644 --- a/Examples/test-suite/lua/cpp_basic_runme.lua +++ b/Examples/test-suite/lua/cpp_basic_runme.lua @@ -73,3 +73,6 @@ f.func_ptr=func1_ptr assert(cb.test_func_ptr(f,2)==16) f.func_ptr=func2_ptr assert(cb.test_func_ptr(f,2)==-8) + +-- Test that __tostring metamethod produce no internal asserts +f2_name = tostring(f2) diff --git a/Lib/lua/luarun.swg b/Lib/lua/luarun.swg index face9c6c9..d3561b1bc 100644 --- a/Lib/lua/luarun.swg +++ b/Lib/lua/luarun.swg @@ -991,17 +991,14 @@ SWIGINTERN int SWIG_Lua_class_tostring(lua_State *L) /* there should be 1 param passed in (1) userdata (not the metatable) */ assert(lua_isuserdata(L,1)); /* just in case */ - unsigned long userData = (unsigned long)lua_touserdata(L,1); /* get the userdata address for later */ + void* userData = lua_touserdata(L,1); /* get the userdata address for later */ lua_getmetatable(L,1); /* get the meta table */ assert(lua_istable(L,-1)); /* just in case */ lua_getfield(L, -1, ".type"); const char *className = lua_tostring(L, -1); - char output[256]; - snprintf(output, 255, "<%s userdata: %lX>", className, userData); - - lua_pushstring(L, (const char*)output); + lua_pushfstring(L, "<%s userdata: %p>", className, userData); return 1; } |