1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-12-22 15:48:48 -05:00

Return nil on empty get_area() (#4508)

This commit is contained in:
James Stevenson 2016-09-09 11:47:13 -04:00 committed by Zeno-
parent c0cd7aa351
commit 403dada85a
2 changed files with 4 additions and 0 deletions

View File

@ -2886,6 +2886,7 @@ chosen for you.
#### Methods #### Methods
* `get_area(id, include_borders, include_data)`: returns the area with the id `id`. * `get_area(id, include_borders, include_data)`: returns the area with the id `id`.
(optional) Boolean values `include_borders` and `include_data` control what's copied. (optional) Boolean values `include_borders` and `include_data` control what's copied.
Returns nil if specified area id does not exist.
* `get_areas_for_pos(pos, include_borders, include_data)`: returns all areas that contain * `get_areas_for_pos(pos, include_borders, include_data)`: returns all areas that contain
the position `pos`. (optional) Boolean values `include_borders` and `include_data` control the position `pos`. (optional) Boolean values `include_borders` and `include_data` control
what's copied. what's copied.

View File

@ -111,6 +111,9 @@ int LuaAreaStore::l_get_area(lua_State *L)
const Area *res; const Area *res;
res = ast->getArea(id); res = ast->getArea(id);
if (!res)
return 0;
push_area(L, res, include_borders, include_data); push_area(L, res, include_borders, include_data);
return 1; return 1;