API:GetGuildPollData
From RoR Wiki
UI Lua API · Guild functions
Version: WAR 1.4.8
Returns the active alliance polls (votes) known to the client.
polls = GetGuildPollData()
Arguments
None.
Returns
- polls
table– Poll tables keyed by poll id. This is not a 1-based array: iterate withpairsor index by poll id.
Each poll table has these fields:
| Key | Type | Meaning |
|---|---|---|
pollType |
number |
Kind of poll. The stock UI compares it with GuildWindow.POLL_TYPE_KICK.
|
subjectID |
number |
Id of the guild the poll is about. |
creatorID |
number |
– |
maxTimer |
number |
– |
votes |
table |
Votes cast so far: keys are voter ids, values are boolean (the vote).
|
locked |
number |
– |
timestampCreated |
number |
Creation time as a raw time value. |
dateCreatedHour24 |
number |
Hour of creation, 0–23. |
dateCreatedMonth |
number |
Month of creation, 1–12. |
dateCreatedDay |
number |
Day of the month of creation. |
dateCreatedYear |
number |
Year of creation. |
Details
- The date fields are
timestampCreatedconverted with the computer's local time zone. - If the Lua state is not available, the function returns nothing.
- A new table is built on every call.
Errors
None.
Example
From default/ea_guildwindow/source/guildwindowtaballiance.lua:
local guildPollData = GetGuildPollData()
...
for pollId, pollData in pairs( guildPollData )
do
if ( ( pollData.subjectID == guild.id ) and ( pollData.pollType == GuildWindow.POLL_TYPE_KICK ) )
then
...
Looking up one poll, from the same file:
local guildPollData = GetGuildPollData() pollData = guildPollData[pollId]
