Merge pull request #153 from v-for-vandal/issue_152
Lua Visual Studio runtime fix using snprintf closes #152
This commit is contained in:
commit
7adc528aa6
2 changed files with 5 additions and 5 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue