X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=doc%2Ftricks.tex;h=9cf86d1559bd8e3c56425f7de4cb141db76e9eac;hb=ae4260bb64817c11f9a7140324cd3e3ba113e297;hp=69fe9459fa57604da8fbe20feac9e743a725b5c5;hpb=8366314611bf30a0f31d25bf5f5023186fa87692;p=ion3.git diff --git a/doc/tricks.tex b/doc/tricks.tex index 69fe945..9cf86d1 100644 --- a/doc/tricks.tex +++ b/doc/tricks.tex @@ -4,20 +4,20 @@ This chapter documents some additional features of the Ion configuration and scripting interface that can be used for more advanced scripting than -the basic configuration exlained in chapter \ref{chap:config}. +the basic configuration explained in chapter \ref{chap:config}. \section{Hooks} \label{sec:hooks} Hooks are lists of functions to be called when a certain event occurs. -There are two types of them; normal and ''alternative'' hooks. Normal +There are two types of them; normal and ``alternative'' hooks. Normal hooks do not return anything, but alt-hooks should return a boolean -indicating whether it handled its assigned task succesfully. In the case +indicating whether it handled its assigned task successfully. In the case that \var{true} is returned, remaining handlers are not called. Hook handlers are registered by first finding the hook with \fnref{ioncore.get_hook} and then calling \fnref{WHook.add} -on the (succesfull) result with the handler as parameter. Similarly +on the (successful) result with the handler as parameter. Similarly handlers are unregistered with \fnref{WHook.remove}. For example: \begin{verbatim} @@ -31,7 +31,7 @@ handlers do. The types of parameters for each hook are listed in the hook reference, section \ref{sec:hookref}. -Note that many of the hooks are called in ''protected mode'' and can not +Note that many of the hooks are called in ``protected mode'' and can not use any functions that modify Ion's internal state. TODO: More detailed documentation when this is final. @@ -39,7 +39,7 @@ documentation when this is final. \subsection{Direct object references} -All Ion objects are passed to Lua scriptss as 'userdatas', and you may +All Ion objects are passed to Lua scripts as 'userdatas', and you may safely store such object references for future use. The C-side object may be destroyed while Lua still refers to the object. All exported functions gracefully fail in such a case, but if you need to explicitly