Clone wiki

libmc / Where_to_put_stuff

Where to put stuff

This is really just a listing of all the tables that exist now or will exist in the future.

  • mc: The only things that go directly in the 'mc' root table are (a) functions related directly to the library itself, or (b) common functions that don't fit elsewhere.
  • mc.logic: Functions used for logic. Really, the best indicator of what goes there is what's in there now.
  • mc.ops: This table will contain functions that wrap every operator - i.e. 'add', 'div', 'lt', 'ge', etc.
  • mc.tty: Functions for console input and output.
  • math: Anything dealing with numbers goes in 'math'. For specialized equations and the like, use subsections like 'math.alg' for algebra, 'math.geom' for geometry, 'math.trig' for trigonometry, etc.
  • math.conv: Unit conversions will go here once implemented.
  • string: Functions used directly on strings. Anything directly in here is a "string method": i.e. can be called using 's:func()'.
  • table: Functions directly in here are used only on array-type tables - tables with only sequential numeric keys. (This was done to match the style of the original 'table' table.) Other types of tables have subtables.
  • table.hash: Functions for use on generic, hash-type tables - tables with varying keys not intended to be used in order.
  • table.meta: Convenience functions for accessing and manipulating metatables.

Updated