fix lua unit.loc and unit.goto

A property cannot returns multiple values, the old code never worked.

Also the value returned by unit.loc the getter is now of the same type as
taken by the unit.loc getter.

this in particular fixes #5098
This commit is contained in:
gfgtdf 2020-08-26 01:20:30 +02:00 committed by GitHub
parent 36cb1cf5e4
commit 2435fc425b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -303,14 +303,12 @@ static int impl_unit_get(lua_State *L)
return_int_attrib("x", u.get_location().wml_x());
return_int_attrib("y", u.get_location().wml_y());
if(strcmp(m, "loc") == 0) {
lua_pushinteger(L, u.get_location().wml_x());
lua_pushinteger(L, u.get_location().wml_y());
return 2;
luaW_pushlocation(L, u.get_location());
return 1;
}
if(strcmp(m, "goto") == 0) {
lua_pushinteger(L, u.get_goto().wml_x());
lua_pushinteger(L, u.get_goto().wml_y());
return 2;
luaW_pushlocation(L, u.get_goto());
return 1;
}
return_int_attrib("side", u.side());
return_string_attrib("id", u.id());