Fix direction property of HUD

This commit is contained in:
rubenwardy 2015-01-07 19:08:51 +00:00 committed by sfan5
parent ef140eb7b0
commit 2504da28af

@ -914,6 +914,10 @@ int ObjectRef::l_hud_add(lua_State *L)
elem->text = getstringfield_default(L, 2, "text", ""); elem->text = getstringfield_default(L, 2, "text", "");
elem->number = getintfield_default(L, 2, "number", 0); elem->number = getintfield_default(L, 2, "number", 0);
elem->item = getintfield_default(L, 2, "item", 0); elem->item = getintfield_default(L, 2, "item", 0);
elem->dir = getintfield_default(L, 2, "direction", 0);
// Deprecated, only for compatibility's sake
if (elem->dir == 0)
elem->dir = getintfield_default(L, 2, "dir", 0); elem->dir = getintfield_default(L, 2, "dir", 0);
lua_getfield(L, 2, "alignment"); lua_getfield(L, 2, "alignment");
@ -1075,6 +1079,10 @@ int ObjectRef::l_hud_get(lua_State *L)
lua_pushnumber(L, e->item); lua_pushnumber(L, e->item);
lua_setfield(L, -2, "item"); lua_setfield(L, -2, "item");
lua_pushnumber(L, e->dir);
lua_setfield(L, -2, "direction");
// Deprecated, only for compatibility's sake
lua_pushnumber(L, e->dir); lua_pushnumber(L, e->dir);
lua_setfield(L, -2, "dir"); lua_setfield(L, -2, "dir");