Lua API

Wish module

Functions to invoke wish and add custom wishing.

Usage

local Wish = ELONA.require("core.Wish")

Functions

wish () Wish something you want.
wish (wish) Wish wish.
match (input, match_type, i18n_key_to_word_list, english_words) Check whether input matches particular words.
add (hook_type, callback) Add custom wishing.

Functions

# wish ()

Wish something you want.

Returns:
  • (bool) True if something happens; otherwise false.
# wish (wish)

Wish wish.

Parameters:
  • wish : (string) Your wish.
Returns:
  • (bool) True if something happens; otherwise false.
# match (input, match_type, i18n_key_to_word_list, english_words)

Check whether input matches particular words.

Parameters:
  • input : (string) Your wish
  • match_type : (Enums.WishMatchType) Match type
  • i18n_key_to_word_list : (string) I18N key to localized word list
  • english_words : (table) List of English words
Returns:
  • (bool) True if match.
# add (hook_type, callback)

Add custom wishing.

Parameters:
  • hook_type : (Enums.WishHook) Hook point
  • callback : (function) Function which takes the input and returns a boolean value (success/failure)
Usage:
-- Add custom wish, 'enormous_money'.
Wish.add('First', function(input)
   if Wish.match(
         input,
         'Include',
         'mod_name.wish.enormous_money',
         {'enormous money'}) then
      Item.create(Chara.player().position, 'core.gold_piece', 1000 * 1000 * 1000)
      GUI.txt(I18N.get('mod_name.wish.get_money'))
      return true
   else
      return false
   end
end)