nut.currency - Chessnut/NutScript GitHub Wiki

This library provides a small system to handle how much is handled.

Methods

  • nut.currency.set(symbol, singular, plural)
  • A shared function to define the symbol and name for the currency.
  • nut.currency.get(amount)
  • Returns a nicely formatted name for amount money. For example, "$1 dollar" would be returned if amount was set to 1.
  • nut.currency.spawn(position, amount[, angle])
  • Spawns a money entity at position with amount money. The optional angle can be provided to set the angle of the money entity created. This function returns the money entity.

Extensions

Character

  • character:hasMoney(amount)
  • Returns a boolean of whether or not the character's money is greater than or equal to amount.
  • character:giveMoney(amount)
  • Adds amount money to the character's current money.
  • character:takeMoney(amount)
  • Removes amount money from the character's current money.