LuaAPI.wiki
changeset 1631 50432569b972
parent 1629 1068da1c7ada
child 1632 4c982152eb2e
equal deleted inserted replaced
1630:ed5018237b13 1631:50432569b972
    71 
    71 
    72 == Globally available variables and constants ==
    72 == Globally available variables and constants ==
    73 The following variables are made available by Hedgewars in Lua and can be used to quickly query a value. Lua scripts schould normally *not* write to these variables, only read from them.
    73 The following variables are made available by Hedgewars in Lua and can be used to quickly query a value. Lua scripts schould normally *not* write to these variables, only read from them.
    74 
    74 
    75 === General variables and constants ===
    75 === General variables and constants ===
    76 Here are some unsorted variables or constants which are available in Lua. You shouldn’t write to most of them.
    76 Here are some unsorted variables or constants which are available in Lua. **Consider these variables to be read-only.**
    77 
    77 
    78 || *Identifier* || *Description* ||
    78 || *Identifier* || *Description* ||
    79 || `LOCALE` || Current locale identifier (e.g. “de” for German) ||
    79 || `LOCALE` || Current locale identifier (e.g. “de” for German) ||
    80 || `LAND_WIDTH` || The width of the landscape in pixels. Not available before `onGameStart` ||
    80 || `LAND_WIDTH` || The width of the landscape in pixels. Not available before `onGameStart` ||
    81 || `LAND_HEIGHT` || The height of the landscape in pixels. Not available before `onGameStart` ||
    81 || `LAND_HEIGHT` || The height of the landscape in pixels. Not available before `onGameStart` ||
    85 || `CursorX` || The X position of the cursor if the player is choosing a target. Otherwise, this is `-2147483648` ||
    85 || `CursorX` || The X position of the cursor if the player is choosing a target. Otherwise, this is `-2147483648` ||
    86 || `CursorY` || The Y position of the cursor if the player is choosing a target. Otherwise, this is `-2147483648` ||
    86 || `CursorY` || The Y position of the cursor if the player is choosing a target. Otherwise, this is `-2147483648` ||
    87 || `WaterLine` || The y position of the water, used to determine at which position stuff drowns. Use `SetWaterLine` to change. ||
    87 || `WaterLine` || The y position of the water, used to determine at which position stuff drowns. Use `SetWaterLine` to change. ||
    88 || `ClansCount` || Number of clans, including defeated ones (a clan is a group of teams with same color) ||
    88 || `ClansCount` || Number of clans, including defeated ones (a clan is a group of teams with same color) ||
    89 || `TeamsCount` || Number of teams, including defeated ones ||
    89 || `TeamsCount` || Number of teams, including defeated ones ||
    90 || `TurnTimeLeft` || Number of game ticks (milliseconds) left until the current turn ends. You can change this variable directly. ||
    90 || `TurnTimeLeft` || Number of game ticks (milliseconds) left until the current turn ends. To set this value, use `SetTurnTimeLeft` ||
    91 || `ReadyTimeLeft` || Remaining ready time in millseconds, 0 if turn in progress. Can be set in onNewTurn. In other places, it should only be read, not written. ||
    91 || `ReadyTimeLeft` || Remaining ready time in millseconds, 0 if turn in progress. To set this value, use `SetReadyTimeLeft` ||
    92 || `GameTime` || Number of total game ticks ||
    92 || `GameTime` || Number of total game ticks ||
    93 || `TotalRounds` || Number of rounds that have passed. Equals `-1` if game has not started yet or hogs are still being placed. This variable is buggy in 0.9.23 and earlier! ||
    93 || `TotalRounds` || Number of rounds that have passed. Equals `-1` if game has not started yet or hogs are still being placed. This variable is buggy in 0.9.23 and earlier! ||
    94 || `CurrentHedgehog` || The hedgehog gear that is currently in play ||
    94 || `CurrentHedgehog` || The hedgehog gear that is currently in play ||
    95 || `AmmoTypeMax` || Maximum ammo type ID (useful to iterate through all ammo types, starting by 0) ||
    95 || `AmmoTypeMax` || Maximum ammo type ID (useful to iterate through all ammo types, starting by 0) ||
    96 
    96