Skip to content

Commit

Permalink
Various updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
seebs committed Mar 24, 2012
1 parent d556cdc commit c779ed6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
9 changes: 9 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2012/03/24:
* Modify available list to include both numeric and charname
keys.
* Call this 0.5.

2012/01/08:
* Fix handling of a second shard once you've already shown up
on one.

2012/01/07:
* Fix dependencies/embed so they actually work.
* 0.3
Expand Down
9 changes: 5 additions & 4 deletions LibAccounts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ function Accounts.table_init()
end
if not LibAccountsGlobal.shards then
LibAccountsGlobal.shards = {}
end
if not LibAccountsGlobal.shards[shard] then
LibAccountsGlobal.shards[shard] = {
chars = {},
accounts = {},
Expand Down Expand Up @@ -94,10 +96,8 @@ end
function Accounts.available_p(charname, acct_only)
local availables = Accounts.available_chars(acct_only)
charname = string.lower(charname)
for _, row in ipairs(availables) do
if string.lower(row.char) == charname then
return true
end
if availables[charname] then
return true
end
return false
end
Expand All @@ -114,6 +114,7 @@ function Accounts.populate(availables, visited, acctid, acct_only)
for char, faction in pairs(Accounts.here.accounts[acctid]) do
factions[faction] = true
table.insert(availables, { char = char, faction = faction, acctid = acctid })
availables[char] = { faction = faction, acctid = acctid }
end
if not acct_only then
for other_acct, chars in pairs(Accounts.here.accounts) do
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=0.3
VERSION=0.5
PACKAGE=LibAccounts
EMBEDS=getopt

Expand Down
7 changes: 5 additions & 2 deletions ReadMe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ The other useful function, of interest mostly to altoholics:

This produces a table:
{ char = char, faction = faction, acctid = acctid }, ...
char = { faction, acctid }, ...

of characters who are "available". That's every character on this account,
plus any characters on other accounts who are of the same faction as at
least one character on this account, and so on recursively.
least one character on this account, and so on recursively. There's numeric
keys for a complete list, or you can just index by a character.

So if you have account #1:
Defiant1
Expand Down Expand Up @@ -57,7 +59,8 @@ Intentionally exposed API:
Yields { char, faction, acctid } tuples for this shard
which are on the current account or reachable from characters
on this account. If acct_only is truthy, checks only
characters on this account.
characters on this account. Also char = { faction, acctid }
tuples.
Library.LibAccounts.acct_of(char)
Returns the acctid, if any, that has the named
character (or player if char is nil)
Expand Down

0 comments on commit c779ed6

Please sign in to comment.