objective_utils.lua --------------------- This script contains utility functions for typical tasks that need to be checked for objectives. To make these function(s) available include this file at the beginning of a script via: .. code-block:: lua include "scripting/objective_utils.lua" .. function:: check_for_buildings(plr, which[, region]) Checks if the number of buildings defined in which are found for the given player. If region is given, buildings are only searched on the corresponding fields. If more buildings or equal the number of requested buildings are found, this function returns :const:`true`. Example usage: .. code-block:: lua check_for_buildings(wl.Game().players[1], {lumberjacks_hut=2, quarry=1}) :arg plr: Player to check for :type plr: :class:`wl.game.Player` :arg which: (name,count) pairs for buildings to check for. :type which: :class:`table` :arg region: array of fields to check for the buildings See also :meth:`wl.map.Field.region` :type region: :class:`array` of :class:`wl.map.Field`. :returns: :const:`true` if the requested buildings were found, :const:`false` otherwise