%medit-defines; ]> &medit; Lua API Introduction Lua scripts running in &medit; have access to its functionality through the moo package. Functions which are not documented here may or may not work differently in the future and they may disappear without notice. Contact the author if you need functions which are not present here. &medit; object model &medit; uses very simple object model where its objects are represented as user data in Lua and methods are provided via metatable shared by all objects of all "classes". Method dispatch is dynamic, i.e. metatable does not contain functions which correspond to methods, and obj:method returns a function object which knows which method on which object it is going to call. This manual lists and talks about "classes", but it is merely to avoid complicated terminology. When we say that an object belongs to or is an instance of a class Foo, it just means that it has methods listed in manual section for class Foo and methods of parent classes, if any. To call a method, you can use both obj:method(args) and obj.method(args). Notations This manual uses the following conventions: Optional parameters func(arg1=val1, arg2=val, arg3=val3, ...) arg=val means that parameter arg is optional, and function receives value val if it's missing. Not all parameters are necessarily optional. For example, insert_text(text, where=nil) means that text may not be missing or nil (unless documentation says otherwise), and where is optional. Keyword parameters func{arg1, arg2=val2} This means that function takes a single table parameter, and table must be a dictionary with keys arg1, arg2, etc. Similarly to regular parameters, arg=val means that arg is optional. Dictionary parameters func(arg1, arg2, {arg3, arg4=val}) {} denote a parameter which must be a table with given keys, similar to keyword parameters (the difference is that with keyword parameters function takes a single table argument). ###GENERATED###