# HG changeset patch # User Wuzzy # Date 1525300931 -3600 # Node ID f7ca5312d2ff8bf563ad70726aa5e3457125d7eb # Parent a0547181393a941a57a78f4b4e1ccdff65f813c9 LuaLibraryTracker: Fix typos and stuff diff -r a0547181393a -r f7ca5312d2ff LuaLibraryTracker.wiki --- a/LuaLibraryTracker.wiki Wed May 02 23:32:42 2018 +0100 +++ b/LuaLibraryTracker.wiki Wed May 02 23:42:11 2018 +0100 @@ -24,6 +24,8 @@ [https://hg.hedgewars.org/hedgewars/file/default/share/hedgewars/Data/Scripts/Multiplayer/Random_Weapon.lua Random Weapons]. == Tracking functions == +These functions must be called to start tracking stuff. *IMPORTANT:* The other functions will only work on tracked objects. So make sure you track the things you care about. + === `trackGear(gear)` === Will keep track of the gear. @@ -40,6 +42,8 @@ Will keep track of the given hedgehog gear when it is un-hidden. == “`runOn`” functions == +These functions are used to run a function on tracked gears, teams and clans. + === `runOnGears(func)` === Runs the function `func` on all gears. @@ -58,20 +62,24 @@ === `runOnHogsInOtherClans(func, clan)` === Runs the function `func` on all hedgehogs but those in the specified clan (`clan` = clan ID). +== Helper functions == +=== `getFirstHogOfClan(clan)` === +Returns the first hedgehog (alive or not) in the clan with clan ID `clan`. + == Key-value storage == -For tracked gears, teams and clans, you can assign an arbitrary number of values. Each tracked object will have a simple key-value storage. Any data type (besides `nil`) can be used for keys and values. +For tracked gears, teams and clans, you can assign an arbitrary number of values. Each tracked object will have a simple key-value storage. Any data type (besides `nil`) can be used for keys and values. Initially, all keys have the value `nil`. === `getGearValue(gear, key)` === -Returns the gear value of the given gear and key. +Returns the gear value of the given `gear` for `key`. === `setGearValue(gear, key, value)` === -Sets the gear value with given `key` to `value`. +Sets the gear value for given `key` to `value`. -=== `increaseGearValue(gear, value)` === -Increase a gear value by 1. This function *must not* be called if the current value is not a number. +=== `increaseGearValue(gear, key)` === +Increases the gear value for `key` by 1. This function *must not* be called if the current value is not a number. -=== `decreaseGearValue(gear, value)` === -Decrease a gear value by 1. This function *must not* be called if the current value is not a number. +=== `decreaseGearValue(gear, key)` === +Decreases the gear value for `key` by 1. This function *must not* be called if the current value is not a number. === `getTeamValue(team, key)` === Returns the value of the given team (`team` is the team name) for the specified `key`. @@ -80,23 +88,19 @@ Sets the team value with given `key` to `value`. `team` is the team name. === `increaseTeamValue(team, key)` === -Increase a team value by 1. `team` is the team name. This function *must not* be called if the current value is not a number. +Increases the team value for `key` by 1. `team` is the team name. This function *must not* be called if the current value is not a number. === `decreaseTeamValue(team, key)` === -Decrease a team value by 1. `team` is the team name. This function *must not* be called if the current value is not a number. +Decreases the team value for `key` by 1. `team` is the team name. This function *must not* be called if the current value is not a number. -=== `getClanValue(team, key)` === +=== `getClanValue(clan, key)` === Returns the value of the given clan (`clan` is the clan ID) for the specified `key`. -=== `setClanalue(team, key, value)` === +=== `setClanValue(clan, key, value)` === Sets the clan value with given `key` to `value`. `clan` is the clan ID. -=== `increaseClanValue(team, key)` === -Increase a clan value by 1. `clan` is the clan ID. This function *must not* be called if the current value is not a number. +=== `increaseClanValue(clan, key)` === +Increases the clan value for `key` by 1. `clan` is the clan ID. This function *must not* be called if the current value is not a number. -=== `decreaseClanValue(team, key)` === -Decrease a clan value by 1. `clan` is the clan ID. This function *must not* be called if the current value is not a number. - -== Convenience functions == -=== `getFirstHogOfClan(clan)` === -Returns the first hedgehog (alive or not) in the clan with clan ID `clan`. \ No newline at end of file +=== `decreaseClanValue(clan, key)` === +Decreases the clan value for `key` by 1. `clan` is the clan ID. This function *must not* be called if the current value is not a number.