Skip to content

Commit

Permalink
Add .size and .is_empty to dList tags. Example: <player.flag[flag_nam…
Browse files Browse the repository at this point in the history
…e].is_empty> will return true/false.
  • Loading branch information
aufdemrand committed Jul 7, 2013
1 parent f191293 commit 2e328c0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/net/aufdemrand/denizen/objects/dList.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ public String getAttribute(Attribute attribute) {
.getAttribute(attribute.fulfill(1));
}

if (attribute.startsWith("size"))
return new Element(size()).getAttribute(attribute.fulfill(1));

if (attribute.startsWith("is_empty"))
return new Element(isEmpty()).getAttribute(attribute.fulfill(1));

if (attribute.startsWith("asstring")
|| attribute.startsWith("as_string")) {
if (isEmpty()) return new Element("").getAttribute(attribute.fulfill(1));
Expand Down

0 comments on commit 2e328c0

Please sign in to comment.