1. #1

    Weakaura health percent decimals

    Hey, I'm using weakaura (2) and want to make a text that shows me the health of myself and another that shows the health of my target (two different texts).

    This is what I've been able to with my very, very, very small amount of knowlegde of LUA and some good time spend searching the internet.

        local percent = (UnitHealth("target")/UnitHealthMax("target"))*100
        return ("%i"):format(percent)

    So this returns me, the health of my target as "100%/99%/98%/..." and so forth. But, I want it to show me more decimals like "100.0%/99.9%/99.8%/99.7%/..." and so on.

    PS: Sorry if this have been asked before, tried my best using the search functions on the official forum and on here. (:

    EDIT: I made it work with

        local percent = (UnitHealth("target")/UnitHealthMax("target"))*100
        return ("%.01f"):format(percent)

    I switched "%i" with "%.01f"
    Last edited by Libertiner; 2013-10-22 at 10:54 PM.

  2. #2
    awesome to see you solved it already. This is how i learned a lot of coding, by taking snippets, trying to customise them and investigating the different parts of the code. Kudos

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts