\hypertarget{group__Elua}{}\section{Elua}
\label{group__Elua}\index{Elua@{Elua}}
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}}
\item 
\#define \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}}
\end{DoxyCompactItemize}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}\label{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}} 
typedef struct \+\_\+\+Elua\+\_\+\+State \mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}}
\begin{DoxyCompactList}\small\item\em Opaque Elua state. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} int \mbox{\hyperlink{group__Elua_gacf7fc6f0386d30e4af4fcb8fd424c8dc}{elua\+\_\+init}} (void)
\begin{DoxyCompactList}\small\item\em Initialize the Elua library. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} int \mbox{\hyperlink{group__Elua_ga8364635553424c58bdbb50f9bb842d9b}{elua\+\_\+shutdown}} (void)
\begin{DoxyCompactList}\small\item\em Shutdown the Elua library. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$ \mbox{\hyperlink{group__Elua_ga95a19b9370dc6704da491c835a0a081a}{elua\+\_\+state\+\_\+new}} (const char $\ast$progname)
\begin{DoxyCompactList}\small\item\em Create a new Elua state. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$ \mbox{\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 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} void \mbox{\hyperlink{group__Elua_ga20ec17a66199e38fe108d522bbf32349}{elua\+\_\+state\+\_\+free}} (\mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$es)
\begin{DoxyCompactList}\small\item\em Destroy an Elua state. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} void \mbox{\hyperlink{group__Elua_ga92e75b39e56082d05c2beb7bdf401a15}{elua\+\_\+state\+\_\+dirs\+\_\+set}} (\mbox{\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 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} void \mbox{\hyperlink{group__Elua_ga3ef02ac4acf29212793720849391d4b8}{elua\+\_\+state\+\_\+dirs\+\_\+fill}} (\mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$es, \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} ignore\+\_\+env)
\begin{DoxyCompactList}\small\item\em Fill the currently unset Elua dirs. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Stringshare__Group_ga2b7dc19609a55e630a96cc1396e38a53}{Eina\+\_\+\+Stringshare}} $\ast$ \mbox{\hyperlink{group__Elua_ga88b12017f24dc905d1056f6f48869872}{elua\+\_\+state\+\_\+core\+\_\+dir\+\_\+get}} (const \mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$es)
\begin{DoxyCompactList}\small\item\em Retrieve the Elua core dir. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Stringshare__Group_ga2b7dc19609a55e630a96cc1396e38a53}{Eina\+\_\+\+Stringshare}} $\ast$ \mbox{\hyperlink{group__Elua_gaeddcbad516e0c2b4906bf5feec03c2f1}{elua\+\_\+state\+\_\+mod\+\_\+dir\+\_\+get}} (const \mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$es)
\begin{DoxyCompactList}\small\item\em Retrieve the Elua module dir. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Stringshare__Group_ga2b7dc19609a55e630a96cc1396e38a53}{Eina\+\_\+\+Stringshare}} $\ast$ \mbox{\hyperlink{group__Elua_gacd7abd5a74916feb6f5fddb05c0086f2}{elua\+\_\+state\+\_\+apps\+\_\+dir\+\_\+get}} (const \mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$es)
\begin{DoxyCompactList}\small\item\em Retrieve the Elua apps dir. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Stringshare__Group_ga2b7dc19609a55e630a96cc1396e38a53}{Eina\+\_\+\+Stringshare}} $\ast$ \mbox{\hyperlink{group__Elua_ga859524263fb615fd54824970ef1764a3}{elua\+\_\+state\+\_\+prog\+\_\+name\+\_\+get}} (const \mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$es)
\begin{DoxyCompactList}\small\item\em Retrieve the prog name set on state creation. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} void \mbox{\hyperlink{group__Elua_ga1c0e7c790bcfb9f0e9b19295d6e953f4}{elua\+\_\+state\+\_\+include\+\_\+path\+\_\+add}} (\mbox{\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 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Elua_gaa25a6712cc9fe309050b90f577ed4721}{elua\+\_\+state\+\_\+require\+\_\+ref\+\_\+push}} (\mbox{\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 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Elua_gaeb1c950c4487106cdb2ed1d915ef4dd4}{elua\+\_\+state\+\_\+appload\+\_\+ref\+\_\+push}} (\mbox{\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 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} lua\+\_\+\+State $\ast$ \mbox{\hyperlink{group__Elua_ga2313864a4afb123511d8b4caeb63d709}{elua\+\_\+state\+\_\+lua\+\_\+state\+\_\+get}} (const \mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$es)
\begin{DoxyCompactList}\small\item\em Retrieve the Lua state from an Elua state. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Elua_ga0a4d8913fce4bb564a3ae7935e1f29a5}{elua\+\_\+state\+\_\+setup}} (\mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$es)
\begin{DoxyCompactList}\small\item\em Set up the Elua state. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} int \mbox{\hyperlink{group__Elua_gaaf5c1391a7660da2bb633e15dbeb8b68}{elua\+\_\+io\+\_\+loadfile}} (const \mbox{\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 IO. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Elua_gafde1f73d35f2521d3812b72b2c3542c1}{elua\+\_\+util\+\_\+require}} (\mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$es, const char $\ast$libname)
\begin{DoxyCompactList}\small\item\em Requires a module. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Elua_ga7a9f852864e3e14dc517fa23ad1167c5}{elua\+\_\+util\+\_\+file\+\_\+run}} (\mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$es, const char $\ast$fname)
\begin{DoxyCompactList}\small\item\em Runs a file. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Elua_ga7936ab36149c7572cc756fe5db6bf91d}{elua\+\_\+util\+\_\+string\+\_\+run}} (\mbox{\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 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} int \mbox{\hyperlink{group__Elua_ga8804ca091a1310f62cab73d592b55f99}{elua\+\_\+util\+\_\+app\+\_\+load}} (\mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$es, const char $\ast$appname)
\begin{DoxyCompactList}\small\item\em Loads an application. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Elua_ga003f5ca8e27d1249f6531318edb65456}{elua\+\_\+util\+\_\+script\+\_\+run}} (\mbox{\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 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} int \mbox{\hyperlink{group__Elua_ga9c5bed4721ba3cc5b8778c59b0c98886}{elua\+\_\+util\+\_\+error\+\_\+report}} (const \mbox{\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}
\mbox{\Hypertarget{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}\label{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}} 
\index{Elua@{Elua}!E\+A\+PI@{E\+A\+PI}}
\index{E\+A\+PI@{E\+A\+PI}!Elua@{Elua}}
\subsubsection{\texorpdfstring{E\+A\+PI}{EAPI}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily \#define E\+A\+PI}

\hypertarget{elementary_main_intro}{}\subsection{Introduction}\label{elementary_main_intro}
The Elua library was created to ease integration of E\+FL Lua into other E\+FL libraries or applications. Using the Elua library you can easily create a Lua state that is fully set up for running E\+FL Lua bindings.

You can find the A\+PI documentation at \mbox{\hyperlink{group__Elua}{Elua}} \mbox{\Hypertarget{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}\label{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}} 
\index{Elua@{Elua}!E\+A\+PI@{E\+A\+PI}}
\index{E\+A\+PI@{E\+A\+PI}!Elua@{Elua}}
\subsubsection{\texorpdfstring{E\+A\+PI}{EAPI}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily \#define E\+A\+PI}

\hypertarget{elementary_main_intro}{}\subsection{Introduction}\label{elementary_main_intro}
The Elua library was created to ease integration of E\+FL Lua into other E\+FL libraries or applications. Using the Elua library you can easily create a Lua state that is fully set up for running E\+FL Lua bindings.

You can find the A\+PI documentation at \mbox{\hyperlink{group__Elua}{Elua}} 

\subsection{Function Documentation}
\mbox{\Hypertarget{group__Elua_gacf7fc6f0386d30e4af4fcb8fd424c8dc}\label{group__Elua_gacf7fc6f0386d30e4af4fcb8fd424c8dc}} 
\index{Elua@{Elua}!elua\+\_\+init@{elua\+\_\+init}}
\index{elua\+\_\+init@{elua\+\_\+init}!Elua@{Elua}}
\subsubsection{\texorpdfstring{elua\+\_\+init()}{elua\_init()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} int elua\+\_\+init (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



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}
\mbox{\hyperlink{group__Elua_ga8364635553424c58bdbb50f9bb842d9b}{elua\+\_\+shutdown}} 
\end{DoxySeeAlso}


References ecore\+\_\+file\+\_\+init(), E\+I\+N\+A\+\_\+\+F\+A\+L\+SE, eina\+\_\+init(), eina\+\_\+log\+\_\+domain\+\_\+register(), E\+I\+N\+A\+\_\+\+L\+O\+G\+\_\+\+E\+RR, and eina\+\_\+log\+\_\+timing().

\mbox{\Hypertarget{group__Elua_ga8364635553424c58bdbb50f9bb842d9b}\label{group__Elua_ga8364635553424c58bdbb50f9bb842d9b}} 
\index{Elua@{Elua}!elua\+\_\+shutdown@{elua\+\_\+shutdown}}
\index{elua\+\_\+shutdown@{elua\+\_\+shutdown}!Elua@{Elua}}
\subsubsection{\texorpdfstring{elua\+\_\+shutdown()}{elua\_shutdown()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} int elua\+\_\+shutdown (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



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}
\mbox{\hyperlink{group__Elua_gacf7fc6f0386d30e4af4fcb8fd424c8dc}{elua\+\_\+init}} 
\end{DoxySeeAlso}


References E\+I\+N\+A\+\_\+\+F\+A\+L\+SE, E\+I\+N\+A\+\_\+\+L\+O\+G\+\_\+\+E\+RR, eina\+\_\+log\+\_\+timing(), and I\+NF.

\mbox{\Hypertarget{group__Elua_ga95a19b9370dc6704da491c835a0a081a}\label{group__Elua_ga95a19b9370dc6704da491c835a0a081a}} 
\index{Elua@{Elua}!elua\+\_\+state\+\_\+new@{elua\+\_\+state\+\_\+new}}
\index{elua\+\_\+state\+\_\+new@{elua\+\_\+state\+\_\+new}!Elua@{Elua}}
\subsubsection{\texorpdfstring{elua\+\_\+state\+\_\+new()}{elua\_state\_new()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}}$\ast$ elua\+\_\+state\+\_\+new (\begin{DoxyParamCaption}\item[{const char $\ast$}]{progname }\end{DoxyParamCaption})}



Create a new Elua state. 

This creates a new Elua state. An Elua state is externally opaque, but it contains a Lua\+J\+IT 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\+LL. 
\end{DoxyReturn}


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

\mbox{\Hypertarget{group__Elua_gaa88407517c877c3558cfbb4b5242bf76}\label{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{\texorpdfstring{elua\+\_\+state\+\_\+from\+\_\+lua\+\_\+state\+\_\+get()}{elua\_state\_from\_lua\_state\_get()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}}$\ast$ elua\+\_\+state\+\_\+from\+\_\+lua\+\_\+state\+\_\+get (\begin{DoxyParamCaption}\item[{lua\+\_\+\+State $\ast$}]{L }\end{DoxyParamCaption})}



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\+LL.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em L} & The Lua state. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
An Elua state or N\+U\+LL. 
\end{DoxyReturn}
\mbox{\Hypertarget{group__Elua_ga20ec17a66199e38fe108d522bbf32349}\label{group__Elua_ga20ec17a66199e38fe108d522bbf32349}} 
\index{Elua@{Elua}!elua\+\_\+state\+\_\+free@{elua\+\_\+state\+\_\+free}}
\index{elua\+\_\+state\+\_\+free@{elua\+\_\+state\+\_\+free}!Elua@{Elua}}
\subsubsection{\texorpdfstring{elua\+\_\+state\+\_\+free()}{elua\_state\_free()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} void elua\+\_\+state\+\_\+free (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$}]{es }\end{DoxyParamCaption})}



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\+EE, and eina\+\_\+stringshare\+\_\+del().

\mbox{\Hypertarget{group__Elua_ga92e75b39e56082d05c2beb7bdf401a15}\label{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{\texorpdfstring{elua\+\_\+state\+\_\+dirs\+\_\+set()}{elua\_state\_dirs\_set()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} void elua\+\_\+state\+\_\+dirs\+\_\+set (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$}]{es,  }\item[{const char $\ast$}]{core,  }\item[{const char $\ast$}]{mods,  }\item[{const char $\ast$}]{apps }\end{DoxyParamCaption})}



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\+LL 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 \mbox{\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}
\mbox{\hyperlink{group__Elua_ga88b12017f24dc905d1056f6f48869872}{elua\+\_\+state\+\_\+core\+\_\+dir\+\_\+get}} 

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

\mbox{\hyperlink{group__Elua_gacd7abd5a74916feb6f5fddb05c0086f2}{elua\+\_\+state\+\_\+apps\+\_\+dir\+\_\+get}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__Elua_ga3ef02ac4acf29212793720849391d4b8}\label{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{\texorpdfstring{elua\+\_\+state\+\_\+dirs\+\_\+fill()}{elua\_state\_dirs\_fill()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} void elua\+\_\+state\+\_\+dirs\+\_\+fill (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$}]{es,  }\item[{\mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}}}]{ignore\+\_\+env }\end{DoxyParamCaption})}



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\+IR, E\+L\+U\+A\+\_\+\+M\+O\+D\+U\+L\+E\+S\+\_\+\+D\+IR, E\+L\+U\+A\+\_\+\+A\+P\+P\+S\+\_\+\+D\+IR) unless the ignore\+\_\+env param is E\+I\+N\+A\+\_\+\+T\+R\+UE. 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\+IR is typically something like /usr/share/elua.

Also, all the paths will be sanitized before setting by calling \mbox{\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\+UE, this ignores the env vars. \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{group__Elua_ga88b12017f24dc905d1056f6f48869872}\label{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{\texorpdfstring{elua\+\_\+state\+\_\+core\+\_\+dir\+\_\+get()}{elua\_state\_core\_dir\_get()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Stringshare__Group_ga2b7dc19609a55e630a96cc1396e38a53}{Eina\+\_\+\+Stringshare}}$\ast$ elua\+\_\+state\+\_\+core\+\_\+dir\+\_\+get (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$}]{es }\end{DoxyParamCaption})}



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}
\mbox{\Hypertarget{group__Elua_gaeddcbad516e0c2b4906bf5feec03c2f1}\label{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{\texorpdfstring{elua\+\_\+state\+\_\+mod\+\_\+dir\+\_\+get()}{elua\_state\_mod\_dir\_get()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Stringshare__Group_ga2b7dc19609a55e630a96cc1396e38a53}{Eina\+\_\+\+Stringshare}}$\ast$ elua\+\_\+state\+\_\+mod\+\_\+dir\+\_\+get (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$}]{es }\end{DoxyParamCaption})}



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}
\mbox{\Hypertarget{group__Elua_gacd7abd5a74916feb6f5fddb05c0086f2}\label{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{\texorpdfstring{elua\+\_\+state\+\_\+apps\+\_\+dir\+\_\+get()}{elua\_state\_apps\_dir\_get()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Stringshare__Group_ga2b7dc19609a55e630a96cc1396e38a53}{Eina\+\_\+\+Stringshare}}$\ast$ elua\+\_\+state\+\_\+apps\+\_\+dir\+\_\+get (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$}]{es }\end{DoxyParamCaption})}



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}
\mbox{\Hypertarget{group__Elua_ga859524263fb615fd54824970ef1764a3}\label{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{\texorpdfstring{elua\+\_\+state\+\_\+prog\+\_\+name\+\_\+get()}{elua\_state\_prog\_name\_get()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Stringshare__Group_ga2b7dc19609a55e630a96cc1396e38a53}{Eina\+\_\+\+Stringshare}}$\ast$ elua\+\_\+state\+\_\+prog\+\_\+name\+\_\+get (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$}]{es }\end{DoxyParamCaption})}



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}
\mbox{\Hypertarget{group__Elua_ga1c0e7c790bcfb9f0e9b19295d6e953f4}\label{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{\texorpdfstring{elua\+\_\+state\+\_\+include\+\_\+path\+\_\+add()}{elua\_state\_include\_path\_add()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} void elua\+\_\+state\+\_\+include\+\_\+path\+\_\+add (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$}]{es,  }\item[{const char $\ast$}]{path }\end{DoxyParamCaption})}



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

The path will be sanitized using \mbox{\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}
\mbox{\Hypertarget{group__Elua_gaa25a6712cc9fe309050b90f577ed4721}\label{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{\texorpdfstring{elua\+\_\+state\+\_\+require\+\_\+ref\+\_\+push()}{elua\_state\_require\_ref\_push()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} elua\+\_\+state\+\_\+require\+\_\+ref\+\_\+push (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$}]{es }\end{DoxyParamCaption})}



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\+UE if the push was successful, E\+I\+N\+A\+\_\+\+F\+A\+L\+SE otherwise. 
\end{DoxyReturn}


Referenced by elua\+\_\+state\+\_\+setup().

\mbox{\Hypertarget{group__Elua_gaeb1c950c4487106cdb2ed1d915ef4dd4}\label{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{\texorpdfstring{elua\+\_\+state\+\_\+appload\+\_\+ref\+\_\+push()}{elua\_state\_appload\_ref\_push()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} elua\+\_\+state\+\_\+appload\+\_\+ref\+\_\+push (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$}]{es }\end{DoxyParamCaption})}



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\+UE if the push was successful, E\+I\+N\+A\+\_\+\+F\+A\+L\+SE otherwise. 
\end{DoxyReturn}
\mbox{\Hypertarget{group__Elua_ga2313864a4afb123511d8b4caeb63d709}\label{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{\texorpdfstring{elua\+\_\+state\+\_\+lua\+\_\+state\+\_\+get()}{elua\_state\_lua\_state\_get()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} lua\+\_\+\+State$\ast$ elua\+\_\+state\+\_\+lua\+\_\+state\+\_\+get (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$}]{es }\end{DoxyParamCaption})}



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\+LL, in which case it will also return N\+U\+LL.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em es} & The Elua state. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The Lua state or N\+U\+LL. 
\end{DoxyReturn}
\mbox{\Hypertarget{group__Elua_ga0a4d8913fce4bb564a3ae7935e1f29a5}\label{group__Elua_ga0a4d8913fce4bb564a3ae7935e1f29a5}} 
\index{Elua@{Elua}!elua\+\_\+state\+\_\+setup@{elua\+\_\+state\+\_\+setup}}
\index{elua\+\_\+state\+\_\+setup@{elua\+\_\+state\+\_\+setup}!Elua@{Elua}}
\subsubsection{\texorpdfstring{elua\+\_\+state\+\_\+setup()}{elua\_state\_setup()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} elua\+\_\+state\+\_\+setup (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$}]{es }\end{DoxyParamCaption})}



Set up the Elua state. 

This A\+PI 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\+UE on success, E\+I\+N\+A\+\_\+\+F\+A\+L\+SE on failure. 
\end{DoxyReturn}


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

\mbox{\Hypertarget{group__Elua_gaaf5c1391a7660da2bb633e15dbeb8b68}\label{group__Elua_gaaf5c1391a7660da2bb633e15dbeb8b68}} 
\index{Elua@{Elua}!elua\+\_\+io\+\_\+loadfile@{elua\+\_\+io\+\_\+loadfile}}
\index{elua\+\_\+io\+\_\+loadfile@{elua\+\_\+io\+\_\+loadfile}!Elua@{Elua}}
\subsubsection{\texorpdfstring{elua\+\_\+io\+\_\+loadfile()}{elua\_io\_loadfile()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} int elua\+\_\+io\+\_\+loadfile (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$}]{es,  }\item[{const char $\ast$}]{fname }\end{DoxyParamCaption})}



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

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\+LL, 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\+LL es). 
\end{DoxyReturn}


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

\mbox{\Hypertarget{group__Elua_gafde1f73d35f2521d3812b72b2c3542c1}\label{group__Elua_gafde1f73d35f2521d3812b72b2c3542c1}} 
\index{Elua@{Elua}!elua\+\_\+util\+\_\+require@{elua\+\_\+util\+\_\+require}}
\index{elua\+\_\+util\+\_\+require@{elua\+\_\+util\+\_\+require}!Elua@{Elua}}
\subsubsection{\texorpdfstring{elua\+\_\+util\+\_\+require()}{elua\_util\_require()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} elua\+\_\+util\+\_\+require (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$}]{es,  }\item[{const char $\ast$}]{libname }\end{DoxyParamCaption})}



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\+UE on success, E\+I\+N\+A\+\_\+\+F\+A\+L\+SE on failure. 
\end{DoxyReturn}
\mbox{\Hypertarget{group__Elua_ga7a9f852864e3e14dc517fa23ad1167c5}\label{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{\texorpdfstring{elua\+\_\+util\+\_\+file\+\_\+run()}{elua\_util\_file\_run()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} elua\+\_\+util\+\_\+file\+\_\+run (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$}]{es,  }\item[{const char $\ast$}]{fname }\end{DoxyParamCaption})}



Runs a file. 

Runs a file. Uses the Elua mmapped file IO 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\+UE on success, E\+I\+N\+A\+\_\+\+F\+A\+L\+SE on failure. 
\end{DoxyReturn}
\mbox{\Hypertarget{group__Elua_ga7936ab36149c7572cc756fe5db6bf91d}\label{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{\texorpdfstring{elua\+\_\+util\+\_\+string\+\_\+run()}{elua\_util\_string\_run()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} elua\+\_\+util\+\_\+string\+\_\+run (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$}]{es,  }\item[{const char $\ast$}]{chunk,  }\item[{const char $\ast$}]{chname }\end{DoxyParamCaption})}



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\+UE on success, E\+I\+N\+A\+\_\+\+F\+A\+L\+SE on failure. 
\end{DoxyReturn}
\mbox{\Hypertarget{group__Elua_ga8804ca091a1310f62cab73d592b55f99}\label{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{\texorpdfstring{elua\+\_\+util\+\_\+app\+\_\+load()}{elua\_util\_app\_load()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} int elua\+\_\+util\+\_\+app\+\_\+load (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$}]{es,  }\item[{const char $\ast$}]{appname }\end{DoxyParamCaption})}



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\+LL, 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}
\mbox{\Hypertarget{group__Elua_ga003f5ca8e27d1249f6531318edb65456}\label{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{\texorpdfstring{elua\+\_\+util\+\_\+script\+\_\+run()}{elua\_util\_script\_run()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} elua\+\_\+util\+\_\+script\+\_\+run (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$}]{es,  }\item[{int}]{argc,  }\item[{char $\ast$$\ast$}]{argv,  }\item[{int}]{n,  }\item[{int $\ast$}]{quit }\end{DoxyParamCaption})}



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\+UE on success, E\+I\+N\+A\+\_\+\+F\+A\+L\+SE on failure. 
\end{DoxyReturn}
\mbox{\Hypertarget{group__Elua_ga9c5bed4721ba3cc5b8778c59b0c98886}\label{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{\texorpdfstring{elua\+\_\+util\+\_\+error\+\_\+report()}{elua\_util\_error\_report()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} int elua\+\_\+util\+\_\+error\+\_\+report (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{group__Elua_ga688a5ca32c81bcaf4811f688c3fec981}{Elua\+\_\+\+State}} $\ast$}]{es,  }\item[{int}]{status }\end{DoxyParamCaption})}



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().

