\hypertarget{group__Elua}{}\section{Elua}
\label{group__Elua}\index{Elua@{Elua}}
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I}
\item 
\#define \hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I}
\end{DoxyCompactItemize}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\hypertarget{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{}typedef struct \+\_\+\+Elua\+\_\+\+State \hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}\label{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}

\begin{DoxyCompactList}\small\item\em Opaque Elua state. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} int \hyperlink{group__Elua_gacf7fc6f0386d30e4af4fcb8fd424c8dc}{elua\+\_\+init} (void)
\begin{DoxyCompactList}\small\item\em Initialize the Elua library. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} int \hyperlink{group__Elua_ga8364635553424c58bdbb50f9bb842d9b}{elua\+\_\+shutdown} (void)
\begin{DoxyCompactList}\small\item\em Shutdown the Elua library. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} \hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$ \hyperlink{group__Elua_ga95a19b9370dc6704da491c835a0a081a}{elua\+\_\+state\+\_\+new} (const char $\ast$progname)
\begin{DoxyCompactList}\small\item\em Create a new Elua state. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} \hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$ \hyperlink{group__Elua_gaa88407517c877c3558cfbb4b5242bf76}{elua\+\_\+state\+\_\+from\+\_\+lua\+\_\+state\+\_\+get} (lua\+\_\+\+State $\ast$L)
\begin{DoxyCompactList}\small\item\em Retrieve an Elua state from a Lua state. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} void \hyperlink{group__Elua_ga20ec17a66199e38fe108d522bbf32349}{elua\+\_\+state\+\_\+free} (\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$es)
\begin{DoxyCompactList}\small\item\em Destroy an Elua state. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} void \hyperlink{group__Elua_ga92e75b39e56082d05c2beb7bdf401a15}{elua\+\_\+state\+\_\+dirs\+\_\+set} (\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$es, const char $\ast$core, const char $\ast$mods, const char $\ast$apps)
\begin{DoxyCompactList}\small\item\em Set the Elua directory paths. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} void \hyperlink{group__Elua_ga3ef02ac4acf29212793720849391d4b8}{elua\+\_\+state\+\_\+dirs\+\_\+fill} (\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$es, \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} ignore\+\_\+env)
\begin{DoxyCompactList}\small\item\em Fill the currently unset Elua dirs. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} \hyperlink{group__Eina__Stringshare__Group_ga2b7dc19609a55e630a96cc1396e38a53}{Eina\+\_\+\+Stringshare} $\ast$ \hyperlink{group__Elua_ga88b12017f24dc905d1056f6f48869872}{elua\+\_\+state\+\_\+core\+\_\+dir\+\_\+get} (const \hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$es)
\begin{DoxyCompactList}\small\item\em Retrieve the Elua core dir. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} \hyperlink{group__Eina__Stringshare__Group_ga2b7dc19609a55e630a96cc1396e38a53}{Eina\+\_\+\+Stringshare} $\ast$ \hyperlink{group__Elua_gaeddcbad516e0c2b4906bf5feec03c2f1}{elua\+\_\+state\+\_\+mod\+\_\+dir\+\_\+get} (const \hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$es)
\begin{DoxyCompactList}\small\item\em Retrieve the Elua module dir. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} \hyperlink{group__Eina__Stringshare__Group_ga2b7dc19609a55e630a96cc1396e38a53}{Eina\+\_\+\+Stringshare} $\ast$ \hyperlink{group__Elua_gacd7abd5a74916feb6f5fddb05c0086f2}{elua\+\_\+state\+\_\+apps\+\_\+dir\+\_\+get} (const \hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$es)
\begin{DoxyCompactList}\small\item\em Retrieve the Elua apps dir. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} \hyperlink{group__Eina__Stringshare__Group_ga2b7dc19609a55e630a96cc1396e38a53}{Eina\+\_\+\+Stringshare} $\ast$ \hyperlink{group__Elua_ga859524263fb615fd54824970ef1764a3}{elua\+\_\+state\+\_\+prog\+\_\+name\+\_\+get} (const \hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$es)
\begin{DoxyCompactList}\small\item\em Retrieve the prog name set on state creation. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} void \hyperlink{group__Elua_ga1c0e7c790bcfb9f0e9b19295d6e953f4}{elua\+\_\+state\+\_\+include\+\_\+path\+\_\+add} (\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$es, const char $\ast$path)
\begin{DoxyCompactList}\small\item\em Add another path to look up modules in to the state. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} \hyperlink{group__Elua_gaa25a6712cc9fe309050b90f577ed4721}{elua\+\_\+state\+\_\+require\+\_\+ref\+\_\+push} (\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$es)
\begin{DoxyCompactList}\small\item\em Push the Elua \char`\"{}require\char`\"{} function onto the Lua stack. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} \hyperlink{group__Elua_gaeb1c950c4487106cdb2ed1d915ef4dd4}{elua\+\_\+state\+\_\+appload\+\_\+ref\+\_\+push} (\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$es)
\begin{DoxyCompactList}\small\item\em Push the Elua app loader function onto the Lua stack. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} lua\+\_\+\+State $\ast$ \hyperlink{group__Elua_ga2313864a4afb123511d8b4caeb63d709}{elua\+\_\+state\+\_\+lua\+\_\+state\+\_\+get} (const \hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$es)
\begin{DoxyCompactList}\small\item\em Retrieve the Lua state from an Elua state. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} \hyperlink{group__Elua_ga0a4d8913fce4bb564a3ae7935e1f29a5}{elua\+\_\+state\+\_\+setup} (\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$es)
\begin{DoxyCompactList}\small\item\em Set up the Elua state. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} int \hyperlink{group__Elua_gaaf5c1391a7660da2bb633e15dbeb8b68}{elua\+\_\+io\+\_\+loadfile} (const \hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$es, const char $\ast$fname)
\begin{DoxyCompactList}\small\item\em Loads a file using Elua\textquotesingle{}s own mmap-\/based I\+O. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} \hyperlink{group__Elua_gafde1f73d35f2521d3812b72b2c3542c1}{elua\+\_\+util\+\_\+require} (\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$es, const char $\ast$libname)
\begin{DoxyCompactList}\small\item\em Requires a module. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} \hyperlink{group__Elua_ga7a9f852864e3e14dc517fa23ad1167c5}{elua\+\_\+util\+\_\+file\+\_\+run} (\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$es, const char $\ast$fname)
\begin{DoxyCompactList}\small\item\em Runs a file. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} \hyperlink{group__Elua_ga7936ab36149c7572cc756fe5db6bf91d}{elua\+\_\+util\+\_\+string\+\_\+run} (\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$es, const char $\ast$chunk, const char $\ast$chname)
\begin{DoxyCompactList}\small\item\em Runs a string. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} int \hyperlink{group__Elua_ga8804ca091a1310f62cab73d592b55f99}{elua\+\_\+util\+\_\+app\+\_\+load} (\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$es, const char $\ast$appname)
\begin{DoxyCompactList}\small\item\em Loads an application. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} \hyperlink{group__Elua_ga003f5ca8e27d1249f6531318edb65456}{elua\+\_\+util\+\_\+script\+\_\+run} (\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$es, int argc, char $\ast$$\ast$argv, int n, int $\ast$quit)
\begin{DoxyCompactList}\small\item\em Runs a script. \end{DoxyCompactList}\item 
\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} int \hyperlink{group__Elua_ga9c5bed4721ba3cc5b8778c59b0c98886}{elua\+\_\+util\+\_\+error\+\_\+report} (const \hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State} $\ast$es, int status)
\begin{DoxyCompactList}\small\item\em Reports an error using Eina logging. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}


\subsection{Macro Definition Documentation}
\hypertarget{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{}\index{Elua@{Elua}!E\+A\+P\+I@{E\+A\+P\+I}}
\index{E\+A\+P\+I@{E\+A\+P\+I}!Elua@{Elua}}
\subsubsection[{E\+A\+P\+I}]{\setlength{\rightskip}{0pt plus 5cm}\#define E\+A\+P\+I}\label{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}
\hypertarget{elocation_main_intro}{}\subsection{Introduction}\label{elocation_main_intro}
The Elua library was created to ease integration of E\+F\+L Lua into other E\+F\+L libraries or applications. Using the Elua library you can easily create a Lua state that is fully set up for running E\+F\+L Lua bindings.

You can find the A\+P\+I documentation at \hyperlink{group__Elua}{Elua} \hypertarget{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{}\index{Elua@{Elua}!E\+A\+P\+I@{E\+A\+P\+I}}
\index{E\+A\+P\+I@{E\+A\+P\+I}!Elua@{Elua}}
\subsubsection[{E\+A\+P\+I}]{\setlength{\rightskip}{0pt plus 5cm}\#define E\+A\+P\+I}\label{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}
\hypertarget{elocation_main_intro}{}\subsection{Introduction}\label{elocation_main_intro}
The Elua library was created to ease integration of E\+F\+L Lua into other E\+F\+L libraries or applications. Using the Elua library you can easily create a Lua state that is fully set up for running E\+F\+L Lua bindings.

You can find the A\+P\+I documentation at \hyperlink{group__Elua}{Elua} 

\subsection{Function Documentation}
\hypertarget{group__Elua_gacf7fc6f0386d30e4af4fcb8fd424c8dc}{}\index{Elua@{Elua}!elua\+\_\+init@{elua\+\_\+init}}
\index{elua\+\_\+init@{elua\+\_\+init}!Elua@{Elua}}
\subsubsection[{elua\+\_\+init(void)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} int elua\+\_\+init (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{group__Elua_gacf7fc6f0386d30e4af4fcb8fd424c8dc}


Initialize the Elua library. 

This initializes the Elua library for usage. It maintains an internal counter so that multiple calls will only increment/decrement correctly.

\begin{DoxySeeAlso}{See also}
\hyperlink{group__Elua_ga8364635553424c58bdbb50f9bb842d9b}{elua\+\_\+shutdown} 
\end{DoxySeeAlso}


References E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E, eina\+\_\+init(), eina\+\_\+log\+\_\+domain\+\_\+register(), E\+I\+N\+A\+\_\+\+L\+O\+G\+\_\+\+E\+R\+R, E\+I\+N\+A\+\_\+\+L\+O\+G\+\_\+\+S\+T\+A\+T\+E\+\_\+\+I\+N\+I\+T, eina\+\_\+log\+\_\+timing(), eina\+\_\+prefix\+\_\+new(), elua\+\_\+init(), E\+R\+R, and I\+N\+F.



Referenced by elua\+\_\+init().

\hypertarget{group__Elua_ga8364635553424c58bdbb50f9bb842d9b}{}\index{Elua@{Elua}!elua\+\_\+shutdown@{elua\+\_\+shutdown}}
\index{elua\+\_\+shutdown@{elua\+\_\+shutdown}!Elua@{Elua}}
\subsubsection[{elua\+\_\+shutdown(void)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} int elua\+\_\+shutdown (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{group__Elua_ga8364635553424c58bdbb50f9bb842d9b}


Shutdown the Elua library. 

Depending on the internal initialization counter, this either decrements or completely shuts down the Elua library. In any case, call this once for each init call.

\begin{DoxySeeAlso}{See also}
\hyperlink{group__Elua_gacf7fc6f0386d30e4af4fcb8fd424c8dc}{elua\+\_\+init} 
\end{DoxySeeAlso}


References E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E, eina\+\_\+log\+\_\+domain\+\_\+unregister(), E\+I\+N\+A\+\_\+\+L\+O\+G\+\_\+\+E\+R\+R, E\+I\+N\+A\+\_\+\+L\+O\+G\+\_\+\+S\+T\+A\+T\+E\+\_\+\+S\+H\+U\+T\+D\+O\+W\+N, eina\+\_\+log\+\_\+timing(), eina\+\_\+prefix\+\_\+free(), eina\+\_\+shutdown(), and I\+N\+F.

\hypertarget{group__Elua_ga95a19b9370dc6704da491c835a0a081a}{}\index{Elua@{Elua}!elua\+\_\+state\+\_\+new@{elua\+\_\+state\+\_\+new}}
\index{elua\+\_\+state\+\_\+new@{elua\+\_\+state\+\_\+new}!Elua@{Elua}}
\subsubsection[{elua\+\_\+state\+\_\+new(const char $\ast$progname)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} {\bf Elua\+\_\+\+State}$\ast$ elua\+\_\+state\+\_\+new (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{progname}
\end{DoxyParamCaption}
)}\label{group__Elua_ga95a19b9370dc6704da491c835a0a081a}


Create a new Elua state. 

This creates a new Elua state. An Elua state is externally opaque, but it contains a Lua\+J\+I\+T state as well as some additional information that is mostly initialized by other A\+P\+Is.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em progname} & The program name that holds the Elua state. This will be used for stuff like error reporting. Typically the same as the binary name of the application (argv\mbox{[}0\mbox{]}). \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A new Elua state or N\+U\+L\+L. 
\end{DoxyReturn}


References eina\+\_\+stringshare\+\_\+add().

\hypertarget{group__Elua_gaa88407517c877c3558cfbb4b5242bf76}{}\index{Elua@{Elua}!elua\+\_\+state\+\_\+from\+\_\+lua\+\_\+state\+\_\+get@{elua\+\_\+state\+\_\+from\+\_\+lua\+\_\+state\+\_\+get}}
\index{elua\+\_\+state\+\_\+from\+\_\+lua\+\_\+state\+\_\+get@{elua\+\_\+state\+\_\+from\+\_\+lua\+\_\+state\+\_\+get}!Elua@{Elua}}
\subsubsection[{elua\+\_\+state\+\_\+from\+\_\+lua\+\_\+state\+\_\+get(lua\+\_\+\+State $\ast$\+L)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} {\bf Elua\+\_\+\+State}$\ast$ elua\+\_\+state\+\_\+from\+\_\+lua\+\_\+state\+\_\+get (
\begin{DoxyParamCaption}
\item[{lua\+\_\+\+State $\ast$}]{L}
\end{DoxyParamCaption}
)}\label{group__Elua_gaa88407517c877c3558cfbb4b5242bf76}


Retrieve an Elua state from a Lua state. 

This doesn\textquotesingle{}t create a new Elua state. Instead it just retrieves an existing Elua state given a Lua state. If no Elua state could be found (for example when the Lua state was created independently of Elua), this function returns N\+U\+L\+L.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em L} & The Lua state. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
An Elua state or N\+U\+L\+L. 
\end{DoxyReturn}
\hypertarget{group__Elua_ga20ec17a66199e38fe108d522bbf32349}{}\index{Elua@{Elua}!elua\+\_\+state\+\_\+free@{elua\+\_\+state\+\_\+free}}
\index{elua\+\_\+state\+\_\+free@{elua\+\_\+state\+\_\+free}!Elua@{Elua}}
\subsubsection[{elua\+\_\+state\+\_\+free(\+Elua\+\_\+\+State $\ast$es)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} void elua\+\_\+state\+\_\+free (
\begin{DoxyParamCaption}
\item[{{\bf Elua\+\_\+\+State} $\ast$}]{es}
\end{DoxyParamCaption}
)}\label{group__Elua_ga20ec17a66199e38fe108d522bbf32349}


Destroy an Elua state. 

Given an Elua state, this destroys its internal Lua state as well as all other data its holding and then frees the Elua state itself.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\end{DoxyParams}


References eina\+\_\+list\+\_\+free(), E\+I\+N\+A\+\_\+\+L\+I\+S\+T\+\_\+\+F\+R\+E\+E, and eina\+\_\+stringshare\+\_\+del().

\hypertarget{group__Elua_ga92e75b39e56082d05c2beb7bdf401a15}{}\index{Elua@{Elua}!elua\+\_\+state\+\_\+dirs\+\_\+set@{elua\+\_\+state\+\_\+dirs\+\_\+set}}
\index{elua\+\_\+state\+\_\+dirs\+\_\+set@{elua\+\_\+state\+\_\+dirs\+\_\+set}!Elua@{Elua}}
\subsubsection[{elua\+\_\+state\+\_\+dirs\+\_\+set(\+Elua\+\_\+\+State $\ast$es, const char $\ast$core, const char $\ast$mods, const char $\ast$apps)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} void elua\+\_\+state\+\_\+dirs\+\_\+set (
\begin{DoxyParamCaption}
\item[{{\bf Elua\+\_\+\+State} $\ast$}]{es, }
\item[{const char $\ast$}]{core, }
\item[{const char $\ast$}]{mods, }
\item[{const char $\ast$}]{apps}
\end{DoxyParamCaption}
)}\label{group__Elua_ga92e75b39e56082d05c2beb7bdf401a15}


Set the Elua directory paths. 

Every Elua state needs three paths -\/ the core script path, the module path and the apps path. The core path refers to from where core scripts will be loaded (such as the module system), the module path refers to from where extra modules will be loaded and the apps path refers to from where Elua applications will be loaded (this is not a module path).

If you provide N\+U\+L\+L for any path, it will not be set. This allows you to split the setting into multiple calls. By the time of state use all need to be set.

Also, all the paths will be sanitized before setting by calling \hyperlink{group__Eina__File__Group_ga7596f37d3a8a548f7223c29c55111c83}{eina\+\_\+file\+\_\+path\+\_\+sanitize} on them.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\mbox{\tt in}  & {\em core} & The core path. \\
\hline
\mbox{\tt in}  & {\em mods} & The modules path. \\
\hline
\mbox{\tt in}  & {\em apps} & The apps path.\\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__Elua_ga88b12017f24dc905d1056f6f48869872}{elua\+\_\+state\+\_\+core\+\_\+dir\+\_\+get} 

\hyperlink{group__Elua_gaeddcbad516e0c2b4906bf5feec03c2f1}{elua\+\_\+state\+\_\+mod\+\_\+dir\+\_\+get} 

\hyperlink{group__Elua_gacd7abd5a74916feb6f5fddb05c0086f2}{elua\+\_\+state\+\_\+apps\+\_\+dir\+\_\+get} 
\end{DoxySeeAlso}


References eina\+\_\+file\+\_\+path\+\_\+sanitize(), eina\+\_\+stringshare\+\_\+add(), and eina\+\_\+stringshare\+\_\+del().

\hypertarget{group__Elua_ga3ef02ac4acf29212793720849391d4b8}{}\index{Elua@{Elua}!elua\+\_\+state\+\_\+dirs\+\_\+fill@{elua\+\_\+state\+\_\+dirs\+\_\+fill}}
\index{elua\+\_\+state\+\_\+dirs\+\_\+fill@{elua\+\_\+state\+\_\+dirs\+\_\+fill}!Elua@{Elua}}
\subsubsection[{elua\+\_\+state\+\_\+dirs\+\_\+fill(\+Elua\+\_\+\+State $\ast$es, Eina\+\_\+\+Bool ignore\+\_\+env)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} void elua\+\_\+state\+\_\+dirs\+\_\+fill (
\begin{DoxyParamCaption}
\item[{{\bf Elua\+\_\+\+State} $\ast$}]{es, }
\item[{{\bf Eina\+\_\+\+Bool}}]{ignore\+\_\+env}
\end{DoxyParamCaption}
)}\label{group__Elua_ga3ef02ac4acf29212793720849391d4b8}


Fill the currently unset Elua dirs. 

This checks if any of the three main paths are unset and tries to fill them from the environment. It first tries environment variables to fill them (E\+L\+U\+A\+\_\+\+C\+O\+R\+E\+\_\+\+D\+I\+R, E\+L\+U\+A\+\_\+\+M\+O\+D\+U\+L\+E\+S\+\_\+\+D\+I\+R, E\+L\+U\+A\+\_\+\+A\+P\+P\+S\+\_\+\+D\+I\+R) unless the ignore\+\_\+env param is E\+I\+N\+A\+\_\+\+T\+R\+U\+E. If it is (or if the environment vars weren\textquotesingle{}t set right) it uses eina prefix of the library to determine the paths. In that case they will expand to D\+A\+T\+A\+D\+I\+R/core, D\+A\+T\+A\+D\+I\+R/modules and D\+A\+T\+A\+D\+I\+R/apps, where D\+A\+T\+A\+D\+I\+R is typically something like /usr/share/elua.

Also, all the paths will be sanitized before setting by calling \hyperlink{group__Eina__File__Group_ga7596f37d3a8a548f7223c29c55111c83}{eina\+\_\+file\+\_\+path\+\_\+sanitize} on them.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\mbox{\tt in}  & {\em ignore\+\_\+env} & If set to E\+I\+N\+A\+\_\+\+T\+R\+U\+E, this ignores the env vars. \\
\hline
\end{DoxyParams}


References eina\+\_\+file\+\_\+path\+\_\+sanitize(), eina\+\_\+prefix\+\_\+data\+\_\+get(), and eina\+\_\+stringshare\+\_\+add().

\hypertarget{group__Elua_ga88b12017f24dc905d1056f6f48869872}{}\index{Elua@{Elua}!elua\+\_\+state\+\_\+core\+\_\+dir\+\_\+get@{elua\+\_\+state\+\_\+core\+\_\+dir\+\_\+get}}
\index{elua\+\_\+state\+\_\+core\+\_\+dir\+\_\+get@{elua\+\_\+state\+\_\+core\+\_\+dir\+\_\+get}!Elua@{Elua}}
\subsubsection[{elua\+\_\+state\+\_\+core\+\_\+dir\+\_\+get(const Elua\+\_\+\+State $\ast$es)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} {\bf Eina\+\_\+\+Stringshare}$\ast$ elua\+\_\+state\+\_\+core\+\_\+dir\+\_\+get (
\begin{DoxyParamCaption}
\item[{const {\bf Elua\+\_\+\+State} $\ast$}]{es}
\end{DoxyParamCaption}
)}\label{group__Elua_ga88b12017f24dc905d1056f6f48869872}


Retrieve the Elua core dir. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The path. 
\end{DoxyReturn}
\hypertarget{group__Elua_gaeddcbad516e0c2b4906bf5feec03c2f1}{}\index{Elua@{Elua}!elua\+\_\+state\+\_\+mod\+\_\+dir\+\_\+get@{elua\+\_\+state\+\_\+mod\+\_\+dir\+\_\+get}}
\index{elua\+\_\+state\+\_\+mod\+\_\+dir\+\_\+get@{elua\+\_\+state\+\_\+mod\+\_\+dir\+\_\+get}!Elua@{Elua}}
\subsubsection[{elua\+\_\+state\+\_\+mod\+\_\+dir\+\_\+get(const Elua\+\_\+\+State $\ast$es)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} {\bf Eina\+\_\+\+Stringshare}$\ast$ elua\+\_\+state\+\_\+mod\+\_\+dir\+\_\+get (
\begin{DoxyParamCaption}
\item[{const {\bf Elua\+\_\+\+State} $\ast$}]{es}
\end{DoxyParamCaption}
)}\label{group__Elua_gaeddcbad516e0c2b4906bf5feec03c2f1}


Retrieve the Elua module dir. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The path. 
\end{DoxyReturn}
\hypertarget{group__Elua_gacd7abd5a74916feb6f5fddb05c0086f2}{}\index{Elua@{Elua}!elua\+\_\+state\+\_\+apps\+\_\+dir\+\_\+get@{elua\+\_\+state\+\_\+apps\+\_\+dir\+\_\+get}}
\index{elua\+\_\+state\+\_\+apps\+\_\+dir\+\_\+get@{elua\+\_\+state\+\_\+apps\+\_\+dir\+\_\+get}!Elua@{Elua}}
\subsubsection[{elua\+\_\+state\+\_\+apps\+\_\+dir\+\_\+get(const Elua\+\_\+\+State $\ast$es)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} {\bf Eina\+\_\+\+Stringshare}$\ast$ elua\+\_\+state\+\_\+apps\+\_\+dir\+\_\+get (
\begin{DoxyParamCaption}
\item[{const {\bf Elua\+\_\+\+State} $\ast$}]{es}
\end{DoxyParamCaption}
)}\label{group__Elua_gacd7abd5a74916feb6f5fddb05c0086f2}


Retrieve the Elua apps dir. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The path. 
\end{DoxyReturn}
\hypertarget{group__Elua_ga859524263fb615fd54824970ef1764a3}{}\index{Elua@{Elua}!elua\+\_\+state\+\_\+prog\+\_\+name\+\_\+get@{elua\+\_\+state\+\_\+prog\+\_\+name\+\_\+get}}
\index{elua\+\_\+state\+\_\+prog\+\_\+name\+\_\+get@{elua\+\_\+state\+\_\+prog\+\_\+name\+\_\+get}!Elua@{Elua}}
\subsubsection[{elua\+\_\+state\+\_\+prog\+\_\+name\+\_\+get(const Elua\+\_\+\+State $\ast$es)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} {\bf Eina\+\_\+\+Stringshare}$\ast$ elua\+\_\+state\+\_\+prog\+\_\+name\+\_\+get (
\begin{DoxyParamCaption}
\item[{const {\bf Elua\+\_\+\+State} $\ast$}]{es}
\end{DoxyParamCaption}
)}\label{group__Elua_ga859524263fb615fd54824970ef1764a3}


Retrieve the prog name set on state creation. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The name. 
\end{DoxyReturn}
\hypertarget{group__Elua_ga1c0e7c790bcfb9f0e9b19295d6e953f4}{}\index{Elua@{Elua}!elua\+\_\+state\+\_\+include\+\_\+path\+\_\+add@{elua\+\_\+state\+\_\+include\+\_\+path\+\_\+add}}
\index{elua\+\_\+state\+\_\+include\+\_\+path\+\_\+add@{elua\+\_\+state\+\_\+include\+\_\+path\+\_\+add}!Elua@{Elua}}
\subsubsection[{elua\+\_\+state\+\_\+include\+\_\+path\+\_\+add(\+Elua\+\_\+\+State $\ast$es, const char $\ast$path)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} void elua\+\_\+state\+\_\+include\+\_\+path\+\_\+add (
\begin{DoxyParamCaption}
\item[{{\bf Elua\+\_\+\+State} $\ast$}]{es, }
\item[{const char $\ast$}]{path}
\end{DoxyParamCaption}
)}\label{group__Elua_ga1c0e7c790bcfb9f0e9b19295d6e953f4}


Add another path to look up modules in to the state. 

The path will be sanitized using \hyperlink{group__Eina__File__Group_ga7596f37d3a8a548f7223c29c55111c83}{eina\+\_\+file\+\_\+path\+\_\+sanitize}.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\end{DoxyParams}


References eina\+\_\+file\+\_\+path\+\_\+sanitize(), eina\+\_\+list\+\_\+append(), and eina\+\_\+stringshare\+\_\+add().

\hypertarget{group__Elua_gaa25a6712cc9fe309050b90f577ed4721}{}\index{Elua@{Elua}!elua\+\_\+state\+\_\+require\+\_\+ref\+\_\+push@{elua\+\_\+state\+\_\+require\+\_\+ref\+\_\+push}}
\index{elua\+\_\+state\+\_\+require\+\_\+ref\+\_\+push@{elua\+\_\+state\+\_\+require\+\_\+ref\+\_\+push}!Elua@{Elua}}
\subsubsection[{elua\+\_\+state\+\_\+require\+\_\+ref\+\_\+push(\+Elua\+\_\+\+State $\ast$es)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} {\bf Eina\+\_\+\+Bool} elua\+\_\+state\+\_\+require\+\_\+ref\+\_\+push (
\begin{DoxyParamCaption}
\item[{{\bf Elua\+\_\+\+State} $\ast$}]{es}
\end{DoxyParamCaption}
)}\label{group__Elua_gaa25a6712cc9fe309050b90f577ed4721}


Push the Elua \char`\"{}require\char`\"{} function onto the Lua stack. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
E\+I\+N\+A\+\_\+\+T\+R\+U\+E if the push was successful, E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E otherwise. 
\end{DoxyReturn}


References E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E, and E\+I\+N\+A\+\_\+\+T\+R\+U\+E.



Referenced by elua\+\_\+state\+\_\+setup(), and elua\+\_\+util\+\_\+require().

\hypertarget{group__Elua_gaeb1c950c4487106cdb2ed1d915ef4dd4}{}\index{Elua@{Elua}!elua\+\_\+state\+\_\+appload\+\_\+ref\+\_\+push@{elua\+\_\+state\+\_\+appload\+\_\+ref\+\_\+push}}
\index{elua\+\_\+state\+\_\+appload\+\_\+ref\+\_\+push@{elua\+\_\+state\+\_\+appload\+\_\+ref\+\_\+push}!Elua@{Elua}}
\subsubsection[{elua\+\_\+state\+\_\+appload\+\_\+ref\+\_\+push(\+Elua\+\_\+\+State $\ast$es)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} {\bf Eina\+\_\+\+Bool} elua\+\_\+state\+\_\+appload\+\_\+ref\+\_\+push (
\begin{DoxyParamCaption}
\item[{{\bf Elua\+\_\+\+State} $\ast$}]{es}
\end{DoxyParamCaption}
)}\label{group__Elua_gaeb1c950c4487106cdb2ed1d915ef4dd4}


Push the Elua app loader function onto the Lua stack. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
E\+I\+N\+A\+\_\+\+T\+R\+U\+E if the push was successful, E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E otherwise. 
\end{DoxyReturn}


References E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E, and E\+I\+N\+A\+\_\+\+T\+R\+U\+E.



Referenced by elua\+\_\+util\+\_\+app\+\_\+load().

\hypertarget{group__Elua_ga2313864a4afb123511d8b4caeb63d709}{}\index{Elua@{Elua}!elua\+\_\+state\+\_\+lua\+\_\+state\+\_\+get@{elua\+\_\+state\+\_\+lua\+\_\+state\+\_\+get}}
\index{elua\+\_\+state\+\_\+lua\+\_\+state\+\_\+get@{elua\+\_\+state\+\_\+lua\+\_\+state\+\_\+get}!Elua@{Elua}}
\subsubsection[{elua\+\_\+state\+\_\+lua\+\_\+state\+\_\+get(const Elua\+\_\+\+State $\ast$es)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} lua\+\_\+\+State$\ast$ elua\+\_\+state\+\_\+lua\+\_\+state\+\_\+get (
\begin{DoxyParamCaption}
\item[{const {\bf Elua\+\_\+\+State} $\ast$}]{es}
\end{DoxyParamCaption}
)}\label{group__Elua_ga2313864a4afb123511d8b4caeb63d709}


Retrieve the Lua state from an Elua state. 

This function retrieves the Lua state from a valid Elua state. As an Elua state is always initialized, this will return a valid state, unless the given Elua state is N\+U\+L\+L, in which case it will also return N\+U\+L\+L.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The Lua state or N\+U\+L\+L. 
\end{DoxyReturn}
\hypertarget{group__Elua_ga0a4d8913fce4bb564a3ae7935e1f29a5}{}\index{Elua@{Elua}!elua\+\_\+state\+\_\+setup@{elua\+\_\+state\+\_\+setup}}
\index{elua\+\_\+state\+\_\+setup@{elua\+\_\+state\+\_\+setup}!Elua@{Elua}}
\subsubsection[{elua\+\_\+state\+\_\+setup(\+Elua\+\_\+\+State $\ast$es)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} {\bf Eina\+\_\+\+Bool} elua\+\_\+state\+\_\+setup (
\begin{DoxyParamCaption}
\item[{{\bf Elua\+\_\+\+State} $\ast$}]{es}
\end{DoxyParamCaption}
)}\label{group__Elua_ga0a4d8913fce4bb564a3ae7935e1f29a5}


Set up the Elua state. 

This A\+P\+I function sets up 3 things, module system, i18n and I/\+O. After that it requires all modules not yet required (i.\+e. those queued in before the state was fully initialized).

This function sets up correct i18n for an Elua state. That means loading the gettext bindings and making Lua aware of them. This also works when i18n support is disabled at compilation time, so you can just call it unconditionally.

This also loads the Elua module system and makes Lua aware of it. It also registers the Elua C utility library module.

Finally, Elua provides its own loadfile based around mmap to replace the less efficient Lua version. This function takes care of the setup.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
E\+I\+N\+A\+\_\+\+T\+R\+U\+E on success, E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E on failure. 
\end{DoxyReturn}


References E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E, E\+I\+N\+A\+\_\+\+L\+I\+S\+T\+\_\+\+F\+R\+E\+E, eina\+\_\+stringshare\+\_\+del(), E\+I\+N\+A\+\_\+\+T\+R\+U\+E, elua\+\_\+state\+\_\+require\+\_\+ref\+\_\+push(), and elua\+\_\+util\+\_\+error\+\_\+report().

\hypertarget{group__Elua_gaaf5c1391a7660da2bb633e15dbeb8b68}{}\index{Elua@{Elua}!elua\+\_\+io\+\_\+loadfile@{elua\+\_\+io\+\_\+loadfile}}
\index{elua\+\_\+io\+\_\+loadfile@{elua\+\_\+io\+\_\+loadfile}!Elua@{Elua}}
\subsubsection[{elua\+\_\+io\+\_\+loadfile(const Elua\+\_\+\+State $\ast$es, const char $\ast$fname)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} int elua\+\_\+io\+\_\+loadfile (
\begin{DoxyParamCaption}
\item[{const {\bf Elua\+\_\+\+State} $\ast$}]{es, }
\item[{const char $\ast$}]{fname}
\end{DoxyParamCaption}
)}\label{group__Elua_gaaf5c1391a7660da2bb633e15dbeb8b68}


Loads a file using Elua\textquotesingle{}s own mmap-\/based I\+O. 

This function behaves identically to lua\+L\+\_\+loadfile when it comes to semantics. The loaded file remains on the Lua stack. If the input state is N\+U\+L\+L, the return value is -\/1 and nothing is left on the stack. On any different error, the error object is left on the stack and this returns a value larger than zero (L\+U\+A\+\_\+\+E\+R\+R$\ast$). On success, zero is returned.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\mbox{\tt in}  & {\em fname} & The file name. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 for no errors, a non-\/zero value for errors (-\/1 for N\+U\+L\+L es). 
\end{DoxyReturn}


References E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E, eina\+\_\+file\+\_\+close(), eina\+\_\+file\+\_\+map\+\_\+all(), eina\+\_\+file\+\_\+map\+\_\+free(), E\+I\+N\+A\+\_\+\+F\+I\+L\+E\+\_\+\+R\+A\+N\+D\+O\+M, and eina\+\_\+file\+\_\+size\+\_\+get().



Referenced by elua\+\_\+util\+\_\+file\+\_\+run(), and elua\+\_\+util\+\_\+script\+\_\+run().

\hypertarget{group__Elua_gafde1f73d35f2521d3812b72b2c3542c1}{}\index{Elua@{Elua}!elua\+\_\+util\+\_\+require@{elua\+\_\+util\+\_\+require}}
\index{elua\+\_\+util\+\_\+require@{elua\+\_\+util\+\_\+require}!Elua@{Elua}}
\subsubsection[{elua\+\_\+util\+\_\+require(\+Elua\+\_\+\+State $\ast$es, const char $\ast$libname)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} {\bf Eina\+\_\+\+Bool} elua\+\_\+util\+\_\+require (
\begin{DoxyParamCaption}
\item[{{\bf Elua\+\_\+\+State} $\ast$}]{es, }
\item[{const char $\ast$}]{libname}
\end{DoxyParamCaption}
)}\label{group__Elua_gafde1f73d35f2521d3812b72b2c3542c1}


Requires a module. 

Requires a Lua module. Leaves the Lua stack clean.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\mbox{\tt in}  & {\em libname} & The library name. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
E\+I\+N\+A\+\_\+\+T\+R\+U\+E on success, E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E on failure. 
\end{DoxyReturn}


References E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E, eina\+\_\+list\+\_\+append(), eina\+\_\+stringshare\+\_\+add(), elua\+\_\+state\+\_\+require\+\_\+ref\+\_\+push(), and elua\+\_\+util\+\_\+error\+\_\+report().

\hypertarget{group__Elua_ga7a9f852864e3e14dc517fa23ad1167c5}{}\index{Elua@{Elua}!elua\+\_\+util\+\_\+file\+\_\+run@{elua\+\_\+util\+\_\+file\+\_\+run}}
\index{elua\+\_\+util\+\_\+file\+\_\+run@{elua\+\_\+util\+\_\+file\+\_\+run}!Elua@{Elua}}
\subsubsection[{elua\+\_\+util\+\_\+file\+\_\+run(\+Elua\+\_\+\+State $\ast$es, const char $\ast$fname)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} {\bf Eina\+\_\+\+Bool} elua\+\_\+util\+\_\+file\+\_\+run (
\begin{DoxyParamCaption}
\item[{{\bf Elua\+\_\+\+State} $\ast$}]{es, }
\item[{const char $\ast$}]{fname}
\end{DoxyParamCaption}
)}\label{group__Elua_ga7a9f852864e3e14dc517fa23ad1167c5}


Runs a file. 

Runs a file. Uses the Elua mmapped file I\+O to load the file.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\mbox{\tt in}  & {\em fname} & The file name. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
E\+I\+N\+A\+\_\+\+T\+R\+U\+E on success, E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E on failure. 
\end{DoxyReturn}


References E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E, elua\+\_\+io\+\_\+loadfile(), and elua\+\_\+util\+\_\+error\+\_\+report().

\hypertarget{group__Elua_ga7936ab36149c7572cc756fe5db6bf91d}{}\index{Elua@{Elua}!elua\+\_\+util\+\_\+string\+\_\+run@{elua\+\_\+util\+\_\+string\+\_\+run}}
\index{elua\+\_\+util\+\_\+string\+\_\+run@{elua\+\_\+util\+\_\+string\+\_\+run}!Elua@{Elua}}
\subsubsection[{elua\+\_\+util\+\_\+string\+\_\+run(\+Elua\+\_\+\+State $\ast$es, const char $\ast$chunk, const char $\ast$chname)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} {\bf Eina\+\_\+\+Bool} elua\+\_\+util\+\_\+string\+\_\+run (
\begin{DoxyParamCaption}
\item[{{\bf Elua\+\_\+\+State} $\ast$}]{es, }
\item[{const char $\ast$}]{chunk, }
\item[{const char $\ast$}]{chname}
\end{DoxyParamCaption}
)}\label{group__Elua_ga7936ab36149c7572cc756fe5db6bf91d}


Runs a string. 

Runs a string.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\mbox{\tt in}  & {\em chunk} & The string to run. \\
\hline
\mbox{\tt in}  & {\em chname} & The chunk name to use for traceback/debug. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
E\+I\+N\+A\+\_\+\+T\+R\+U\+E on success, E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E on failure. 
\end{DoxyReturn}


References E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E, and elua\+\_\+util\+\_\+error\+\_\+report().

\hypertarget{group__Elua_ga8804ca091a1310f62cab73d592b55f99}{}\index{Elua@{Elua}!elua\+\_\+util\+\_\+app\+\_\+load@{elua\+\_\+util\+\_\+app\+\_\+load}}
\index{elua\+\_\+util\+\_\+app\+\_\+load@{elua\+\_\+util\+\_\+app\+\_\+load}!Elua@{Elua}}
\subsubsection[{elua\+\_\+util\+\_\+app\+\_\+load(\+Elua\+\_\+\+State $\ast$es, const char $\ast$appname)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} int elua\+\_\+util\+\_\+app\+\_\+load (
\begin{DoxyParamCaption}
\item[{{\bf Elua\+\_\+\+State} $\ast$}]{es, }
\item[{const char $\ast$}]{appname}
\end{DoxyParamCaption}
)}\label{group__Elua_ga8804ca091a1310f62cab73d592b55f99}


Loads an application. 

This loads an app, respecting the app path set on state initialization. Actually runs the app. If the input state is N\+U\+L\+L, the return value is -\/1 nd nothing is left on the stack. On any different error, the error object is left on the stack and this returns 1. On success, zero is returned (and the return value from the app is left on the stack).


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\mbox{\tt in}  & {\em appname} & The application name. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 for no errors, 1 on errors, -\/1 on null input. 
\end{DoxyReturn}


References elua\+\_\+state\+\_\+appload\+\_\+ref\+\_\+push().



Referenced by elua\+\_\+util\+\_\+script\+\_\+run().

\hypertarget{group__Elua_ga003f5ca8e27d1249f6531318edb65456}{}\index{Elua@{Elua}!elua\+\_\+util\+\_\+script\+\_\+run@{elua\+\_\+util\+\_\+script\+\_\+run}}
\index{elua\+\_\+util\+\_\+script\+\_\+run@{elua\+\_\+util\+\_\+script\+\_\+run}!Elua@{Elua}}
\subsubsection[{elua\+\_\+util\+\_\+script\+\_\+run(\+Elua\+\_\+\+State $\ast$es, int argc, char $\ast$$\ast$argv, int n, int $\ast$quit)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} {\bf Eina\+\_\+\+Bool} elua\+\_\+util\+\_\+script\+\_\+run (
\begin{DoxyParamCaption}
\item[{{\bf Elua\+\_\+\+State} $\ast$}]{es, }
\item[{int}]{argc, }
\item[{char $\ast$$\ast$}]{argv, }
\item[{int}]{n, }
\item[{int $\ast$}]{quit}
\end{DoxyParamCaption}
)}\label{group__Elua_ga003f5ca8e27d1249f6531318edb65456}


Runs a script. 

This is a more complicated function that runs a script. It\textquotesingle{}s a combination of the previously mentioned util functions. It takes argc and argv, which are typically given to the program, and an index of the first positional arg in argv (i.\+e. not options). The value on this index is then used as the potential name.

If this name is either a dash or empty, the script is loaded from stdin. If it\textquotesingle{}s a value and a file with this name exists, the script is loaded from the file. Otherwise, the name is treated to be an application name, and is loaded from the application path.

If all succeeds, this is then run, and a quit value is written into the quit arg; if it\textquotesingle{}s true (1), it means the app wants to exit immediately. If it\textquotesingle{}s false (0), it means the app likely wants to execute a main loop.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\mbox{\tt in}  & {\em argc} & The argument count. \\
\hline
\mbox{\tt in}  & {\em argv} & The arguments. \\
\hline
\mbox{\tt in}  & {\em n} & The index of the first positional argt. \\
\hline
\mbox{\tt out}  & {\em quit} & Whether to quit or run a main loop. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
E\+I\+N\+A\+\_\+\+T\+R\+U\+E on success, E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E on failure. 
\end{DoxyReturn}


References elua\+\_\+io\+\_\+loadfile(), elua\+\_\+util\+\_\+app\+\_\+load(), and elua\+\_\+util\+\_\+error\+\_\+report().

\hypertarget{group__Elua_ga9c5bed4721ba3cc5b8778c59b0c98886}{}\index{Elua@{Elua}!elua\+\_\+util\+\_\+error\+\_\+report@{elua\+\_\+util\+\_\+error\+\_\+report}}
\index{elua\+\_\+util\+\_\+error\+\_\+report@{elua\+\_\+util\+\_\+error\+\_\+report}!Elua@{Elua}}
\subsubsection[{elua\+\_\+util\+\_\+error\+\_\+report(const Elua\+\_\+\+State $\ast$es, int status)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} int elua\+\_\+util\+\_\+error\+\_\+report (
\begin{DoxyParamCaption}
\item[{const {\bf Elua\+\_\+\+State} $\ast$}]{es, }
\item[{int}]{status}
\end{DoxyParamCaption}
)}\label{group__Elua_ga9c5bed4721ba3cc5b8778c59b0c98886}


Reports an error using Eina logging. 

If the given status is 0, this function just returns it. Otherwise, it takes the topmost item on the Lua stack, converts it to string (if it cannot be converted, a \char`\"{}(non-\/string error)\char`\"{} placeholder is used) and logs it out as an error, together with the program name set on Elua state init.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\mbox{\tt in}  & {\em status} & The status code. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The status code. 
\end{DoxyReturn}


Referenced by elua\+\_\+state\+\_\+setup(), elua\+\_\+util\+\_\+file\+\_\+run(), elua\+\_\+util\+\_\+require(), elua\+\_\+util\+\_\+script\+\_\+run(), and elua\+\_\+util\+\_\+string\+\_\+run().

