Module core
Core functions and object orientation
Functions
| class (name, ...) | Create a new class type | 
| getattr (cls, value) | Indexing that supports Python-like property getters | 
| setattr (cls, key, value) | Index setting that supports Python-like property setters | 
| copy (object, deep) | Copy an object | 
| isinstance (klass, other) | Check if class is an instance of another class recursively | 
| print (...) | Write a string to stdout (or to log.txt in AutoTouch) | 
| pprint (tbl) | Pretty print a table | 
| property (klass, name, getter, setter) | Create a property on a class | 
| str (input) | Convert any object into a string | 
Functions
- class (name, ...)
- 
    Create a new class type
    Parameters:- name string name of the class
- ... base classes to inherit from
 Usage:-- create class A A = class('A') function A:__init(value) self.value = value end -- Create class B that inherits from A B = class('B', 'A') -- Create and use instances a = A(5) assert(a.value == 5) b = B(5) assert(b.value == 5) 
- getattr (cls, value)
- 
    Indexing that supports Python-like property getters
    Parameters:- cls
- value
 
- setattr (cls, key, value)
- 
    Index setting that supports Python-like property setters
    Parameters:- cls
- key
- value
 
- copy (object, deep)
- 
    Copy an object
    Parameters:- object any table-like object
- deep whether to copy recursively
 Returns:- 
        copy of object at a new memory location
    
 
- isinstance (klass, other)
- 
    Check if class is an instance of another class recursively
    Parameters:- klass
- other
 Returns:- 
        boolean
    
 
- print (...)
- 
    Write a string to stdout (or to log.txt in AutoTouch)
    Parameters:- ...
 Returns:
- pprint (tbl)
- 
    Pretty print a table
    Parameters:- tbl table
 
- property (klass, name, getter, setter)
- 
    Create a property on a class
    Parameters:- klass class type to add the property to
- name string name of the property
- getter func function to get the value of the property
- setter func function to set the value of the property
 Usage:A = class('A') function A:__init(value) self._private = value end property(A, 'value', function(self) return self._private * 2 end, function(self, value) self._private = value * 2 end ) a = A(1) assert(a.value == 2) a.value = 2 assert(a.value == 8) 
- str (input)
- 
    Convert any object into a string
    Parameters:- input any object
 Returns:- 
           string
        string representation of object