Note that there are some explanatory texts on larger screens.

plurals
  1. POLua Wrapper Class - Exposing c++ static methods to Lua trough a DLL
    primarykey
    data
    text
    <p>I finally got into a problem that I can't find a solution here. I'm using a Lua Wrapper Class found in here <a href="http://lua-users.org/wiki/CppConvenientLuaWrapperClass" rel="nofollow">http://lua-users.org/wiki/CppConvenientLuaWrapperClass</a>. We've been able to expose a complete API plus more other funcionalities like serial communication and on. </p> <p>The concept behind this Lua Wrapper is that you expose every method before compiling so when you're running your programm all methods will be added to the Lua Stack and in that way you can execute them. The idea now is to build kind of a Dll in order to complete this process of exposing methods. This way you won't needed to release a version with all exposed methods instead you load them trough multiple dll files.</p> <p>I've tried to create another table and register other methods in that table, but with that, previous exposed methods stop working.</p> <p>The other way around I can think of, is to create a dll but in C that contains all desirable methods and load it directly to Lua. But I think the other way would be better.</p> <p>Have you been able to do something similar ? Am I having some wrong concept?</p> <p>Thanks</p> <p>Humm... I really don't want to change our wrapper at this time. I think I could manage to do it, sort of. Instead of adding a new table for the plugin functions, I've added a new sub-table tha will contain the functions names and cClosures to be called from Lua. So at the end we should have:</p> <pre><code>application.functionName() application.plugin.functionName() </code></pre> <p>Even if it work this way it will do fine. Now I wonder how can we reference the lua_settable when exposing the functions to be added to application[plugin][pluginFunction] instead of aplication[pluginFunction]?! This is how the normal functions are exposed:</p> <pre><code>//mState is a pointer to a Lua_State lua_pushstring( mState, functionName ); //methodDesc is a pointer to an object that describes the function arguments/returns lua_pushlightuserdata( mState, methodDesc ); //exposeMethodProxy is the method that is responsible for conneting lua c-calls to the c-functions lua_pushcclosure( mState, exposedMethodProxy, 1 ); //mMethodTableIndex is a member variable that contains the index of the table tha hold all exposed functions lua_settable( mState, mMethodTableIndex ); </code></pre> <p>Any ideas on how I could achieve adding the cclosures not to the main table(at mMethodTableIndex) as mainTable[functionName] but at maintable[plugin][functionNane].?</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.
 

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