From dd2c62721c729abcc51f0c323629d05b0f71c40c Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 6 Feb 2009 11:55:09 +0100 Subject: [PATCH] tag: add compatibility with old constructor proto Signed-off-by: Julien Danjou --- tag.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tag.c b/tag.c index 10a611beb..c9edc1e30 100644 --- a/tag.c +++ b/tag.c @@ -255,7 +255,19 @@ static int luaA_tag_new(lua_State *L) { size_t len; - const char *name = luaL_checklstring(L, 2, &len); + const char *name; + + if(lua_istable(L, 2)) + { + /* deprecation warning */ + luaA_warn(L, "%s: This function prototype changed, see API documentation", + __FUNCTION__); + lua_getfield(L, 2, "name"); + name = luaL_checklstring(L, -1, &len); + } + else + name = luaL_checklstring(L, 2, &len); + return luaA_tag_userdata_new(L, tag_new(name, len)); }