tag: add compatibility with old constructor proto
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
e0754de9cb
commit
dd2c62721c
14
tag.c
14
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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue