Skip to content

Documentation

Andre Louis Issa edited this page Nov 16, 2022 · 41 revisions

Components

Documentation Notation

Types can be joined by | to indicate multiple suitable types

Base lua types:

  • nil, boolean, number, string, thread, userdata
  • table (with [KEYTYPES] and {VALUETYPES} if relevant)
  • function (shown as type (ARGUMENTS)->(RETURNS))

Extra types defined for greater specificity:

  • ~nil: anything that isn't nil
  • *table: a table with a modified metatable
  • Val: nil|boolean|number|string
  • Ref: table|*table|thread|userdata|(...)->(...)
  • Int: ...-2,-1,0,-1,2... (integers)
  • +Int: 1,2,3... (positive integers)
  • Array: tables with only +Int keys and all such keys between 1 and #table inclusive are not nil
  • Path: String keys joined by single periods to mimic the shape of nested table fields
  • Mod: A table registered as a mod, produced by ModUtil.Mod.Register
  • File: file userdata (used by the io package)
  • Button, Obstacle, Screen, Screen.Component: Hades specific objects

Interface

Members accessible via the ModUtil table.

Mods.Data *table[Path]{Mod} Collection of all the registered mods by their canonical path
Mods.Inverse *table[Mod]{Path} Lookup of the canonical path by mod object
Identifiers.Data *table[Ref]{string} Map from object to associated name (name is part of the object's string representation)
Identifiers.Inverse *table[string]{Ref} Map from name to associated object (name is part of the object's string representation)
Node.Data *table[string]{*table} Collection of traversal nodes for use as special keys in index arrays
Node.Inverse *table{*table}[string] Lookup table of traversal nodes to distinguish them from regular keys
Proxy data(table), meta(nil|table) proxy(*table)
Creates a proxy of data using meta to define the interface (meta can keep a reference to data beforehand or can get it from ModUtil.Internal.objectData[proxy])
Raw obj(table) raw(*table)
Creates a proxy raw of obj, where table operations ignore the metatable of obj
Callable obj(table|(...)->(...)) callable(boolean)
Checks if obj is callable (either a function or has the __call metamethod mapped to a callable).
Callable.Get obj(table|(...)->(...)) parent(nil|table), func(nil|(self,...)->(...))
Gets the function func that the callable obj uses, along with the mutable parent non-function callable if it exists.
Callable.Set obj(table), func(nil|(self,...)->(...)) parent(nil|*table), func(nil|(self,...)->(...))
Sets the __call metamethod of obj to func (obj becomes the parent to func in this sense)
Callable.Map obj(table), map((func,...)->(newfunc)), ... parent(nil|*table), newfunc(nil|(self,...)->(...))
Changes the function func the callable obj uses into newfunc by applying map and mutating parent
Callable.Func.Get obj(table|((...)->(...))) func(nil|(self,...)->(...))
Gets the function func that the callable obj uses
Callable.Func.Set obj(table), func(nil|(self,...)->(...)) func(nil|(self,...)->(...))
Sets the __call metamethod of obj to func
Callable.Func.Map obj(table), map((func,...)->(newfunc)), ... func(nil|(self,...)->(...))
Changes the function func the callable obj uses into newfunc by applying map
Args.Map map((in)->(out)), ... ...
Applies map to each argument and returns the results
Args.Take n(+Int), ... ...
Returns only the first n arguments
Args.Drop n(+Int), ... ...
Skips over the first n arguments and returns the rest
Table.Map tbl(table), map((in)->(out)) out(tbl)
Creates a new table out comprised of applying map to each value of tbl
Table.Mutate tbl(table), map((in)->(out))
Modifies tbl by setting each value to its result after applying map
Table.Replace target(table), data(table)
Modifies target by replacing all its entries with those from data
Table.UnKeyed tbl(table) keyed(boolean)
Determines if tbl is suitable to use with functions designed for Arrays (the keys are all successive indices)
String.Join sep(string), ...(string) out(string)
String.Chunk text(string), chunkSize(+Int), maxChunks(+Int) chunks(Array{string})
ToString object repr(string)
ToString.Address object(table|(...)->(...)|thread|userdata) repr(string)
ToString.Static object(table|(...)->(...)|thread|userdata) repr(string)
ToString.Value object repr(string)
ToString.Key object repr(string)
ToString.TableKeys object(table) repr(string)
ToString.Shallow object, limit(nil|Nat), indent(nil|string) repr(string)
ToString.Deep object, limit(nil|Nat), depth(nil|Nat), indent(nil|string) repr(string)
ToString.Deep.NoNamespaces object, limit(nil|Nat), depth(nil|Nat), indent(nil|string) repr(string)
ToString.Deep.Namespaces object, limit(nil|Nat), depth(nil|Nat), indent(nil|string) repr(string)
Print ...
Print.ToFile file(string|File), ...
Print.Debug ...
Print.Traceback level(+Int|nil)
Print.DebugInfo level(+Int|nil)
Print.Namespaces level(+Int|nil)
Print.Variables level(+Int|nil)
DebugCall func((...)->(...)), ... ...
Array.Slice state(Array), start(Int|nil), stop(Int|nil), step(Int|nil) slice(Array)
Array.Copy data(Array) copy(Array)
Array.Join ...(Array) out(Array)
Table.Copy data(table) copy(table)
Table.Copy.Deep data(table) copy(table)
Table.Clear data(table) data(table)
Table.Transpose data(table) flipped(table)
Table.Flip data(table) data(table)
Table.NilMerge in(table), nil(table) in(table)
Table.Merge in(table), set(table) in(table)
Table.MergeKeyed in(table), set(table) in(table)
IndexArray.Get base(table), index(table) result
IndexArray.Set base(table), index(Array), value success(boolean)
IndexArray.Map base(table), index(Array) success(boolean)
Path.Join ...(Path) path(Path)
Path.Map path(Path) success(boolean)
Path.IndexArray path(Path) index(Array)
Path.Get path(Path) result
Path.Set path(Path), value success(boolean)
Path.Map path(Path) success(boolean)
StackLevel level(nil|+Int) info(nil|*table)
StackLevels level(nil|+Int) info(nil|*table)
UpValues func((...)->(...)|+Int|nil) ups(*table)
UpValues.Ids func((...)->(...)|+Int|nil) ups(*table)
UpValues.Values func((...)->(...)|+Int|nil) ups(*table)
UpValues.Names func((...)->(...)|+Int|nil) ups(*table)
UpValues.Stacked func((...)->(...)|+Int|nil) ups(*table)
Locals level(+Int|nil) locals(*table)
Locals.Values level(+Int|nil) locals(*table)
Locals.Names level(+Int|nil) locals(*table)
Locals.Stacked level(+Int|nil) locals(*table)
Entangled.Union ...(table) union(*table)
Entangled.Union.Add union(*table), ...(table)
Entangled.Union.Sub union(*table), ...(table)
Entangled.Map pair(table{*table})
Entangled.Map.Unique pair(table{*table})
Context prep((info)->(...)), post((info)->(...)) context(*table)
Context.Data data(table), context(()->())
Context.Meta object, context(()->())
Context.Call func((...)->(...)), context(()->()), ... ...
Context.Env func((...)->(...)), context(()->())
Context.Wrap func((...)->(...)), context(()->()), mod(Mod)
Context.Wrap.Static func((...)->(...)), context(()->()), mod(Mod)
Node.New parent(table), key(~nil) tbl(table)
Node.Data.Meta.New object meta(table)
Node.Data.Meta.Get object meta(table)
Node.Data.Meta.Set object success(boolean)
Node.Data.Call.New object(table|(...)->(...)) parent(nil|table), func(nil|(self,...)->(...))
Node.Data.Call.Get object(table|(...)->(...)) parent(nil|table), func(nil|(self,...)->(...))
Node.Data.Call.Set object(table|(...)->(...)), func(nil|(self,...)->(...)) success(boolean)
Node.Data.UpValues.New func((...)->(...) ups(*table)
Node.Data.UpValues.Get func((...)->(...) ups(*table)
Node.Data.UpValues.Set
Decorate base(Ref), deco((base(Ref))->(post(Ref))), mod(Mod) post(Ref)
Decorate.Pop object(Ref) base(Ref)
Decorate.Inject base(Ref), deco((base(Ref))->(post(Ref))), mod(Mod) post(Ref)
Decorate.Eject object(Ref) base(Ref)
Decorate.Refresh base(Ref) refbase(Ref)
Wrap base((...)->(...)), wrap((base((...)->(...)),...)->(...)), mod(Mod) func((...)->(...))
Override base(Ref), value(Ref), mod(Mod) value(Ref)
Restore base(Ref) refbase(Ref)
Overriden object(Ref) value(Ref)
Original object(Ref) value(Ref)
ReferFunction get(()->(obj)) func((...)->(...))
ReferTable get(()->(obj)) table(*table)
Clone this wiki locally