Class Translator

BaseClass for an translator strategy.

This class follows the pattern with inheritance from Lua classes.

Metamethods

Translator:__index (key) Lookup of missing class members.

Methods

Translator:create (...) Create a new instance.
Translator:_init (...) Initialize a new instance.
Translator:type () Get the type of the strategy.
Translator:find (str, pos) Try to find the string for this strategy.
Translator:cast (str, start, finish) Cast the string into the correct type for this strategy.
Translator:placeholder () Get the placeholder for this strategy.


Metamethods

Translator:__index (key)
Lookup of missing class members.

Parameters:

Returns:

any

Methods

Translator:create (...)
Create a new instance.

Parameters:

  • ... vararg list of patterns(?)

Returns:

self
Translator:_init (...)
Initialize a new instance.

Parameters:

  • ... vararg list of patterns(?)

Returns:

self
Translator:type ()
Get the type of the strategy. All translator strategies have an explicit type name.

Returns:

string
Translator:find (str, pos)
Try to find the string for this strategy. The goodness of the match is given by the returned position. If found it should return a position and the found string.

Parameters:

  • str string the extraction source
  • pos number of the inclusive index where extraction starts

Returns:

nil or number,number
Translator:cast (str, start, finish)
Cast the string into the correct type for this strategy.

Parameters:

  • str string the extraction source (unused)
  • start number of the inclusive index where extraction starts (unused)
  • finish number of the inclusive index where extraction finishes (unused)

Returns:

nil

Raises:

Unconditional unless overridden
Translator:placeholder ()
Get the placeholder for this strategy.

Returns:

string

Raises:

Unconditional unless overridden
generated by LDoc 1.4.6