Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not sure, you're clear on what you want to do. A typical way to extend lua is to write a DLL with a single method that uses the Lua API to register your C++ types and C functions. To conviniently bind C++ functions and classes, you could use <a href="https://github.com/vinniefalco/LuaBridge" rel="nofollow">LuaBridge</a>. An example of such binding is here: <a href="https://github.com/d-led/xerceslua" rel="nofollow">https://github.com/d-led/xerceslua</a></p> <p>The header for the DLL of the xerceslua module contains only one function:</p> <pre><code>#include &lt;lua.hpp&gt; void register_xerceslua (lua_State* L); </code></pre> <p>inside the implementation LuaBridge is used to bind to C++:</p> <pre><code>#include "xerceslua_lib.h" #include &lt;lua.hpp&gt; #include &lt;LuaBridge.h&gt; void register_xerceslua (lua_State* L) { ... luabridge::getGlobalNamespace(L) .beginNamespace("xerces") .addVariable("version",&amp;version,false) ... </code></pre> <p>in Lua you can then access the exposed C++ API:</p> <pre><code>assert(require 'xerceslua') local parser=xerces.XercesDOMParser() parser:loadGrammar("Employee.dtd",xerces.GrammarType.DTDGrammarType) </code></pre> <p>You can use Lua both as an embedded scripting language, where you can execute lua <a href="http://csl.name/lua/" rel="nofollow">from within your software</a>, or you could use it as an extensible scripting language, extending it using the method shown above. Both are valid, but you have to consider, what exactly you are trying to do.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload