From 74e4200176dfeca0522e5f83d41a22607219a6ae Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 9 Apr 2009 11:34:38 +0200 Subject: [PATCH] luaa: split tostring creation Signed-off-by: Julien Danjou --- luaa.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/luaa.h b/luaa.h index 8efa082e..cdc8e09e 100644 --- a/luaa.h +++ b/luaa.h @@ -39,6 +39,15 @@ luaA_warn(L, "%s: This function is deprecated and will be removed, see %s", \ __FUNCTION__, repl) +#define DO_LUA_TOSTRING(type, prefix, lua_type) \ + static int \ + luaA_##prefix##_tostring(lua_State *L) \ + { \ + type *p = luaL_checkudata(L, 1, lua_type); \ + lua_pushfstring(L, lua_type ": %p", p); \ + return 1; \ + } + #define DO_LUA_NEW(decl, type, prefix, lua_type, type_ref) \ decl int \ luaA_##prefix##_userdata_new(lua_State *L, type *p) \