Search code examples
class-methodfflanura

Understanding the lib keyword


Is lib a special keyword for Frogatto Formula Language (FFL)? That seems to be the way of invoking class methods. For example:

where frog = lib.citadel.create_creature('Giant Frog')

Also, I am interested to know where can I find a list of all the available lib.**** library objects and how to list of all their available functions.


Solution

  • I wouldn't call it a keyword as such, more a symbol that appears in the standard namespace. As such it is functionally fairly close to a keyword.

    When you create a class by adding a file e.g. data/classes/blah.cfg then a singleton instance of this class will be available using lib.blah. This is a convenient way of effectively creating your own namespace of functions -- create a class, add functions to it, then your functions can be accessed using lib.classname.functionname()