I just began learning C++ and only a few minutes ago discovered the fun of creating DLL's in VC++. I'm sure this is a noobish question, but is it possible to use C++ functions defined in DLL's through a Lua script defined in Mudlet?
If so, how? If not, is there another way?
Lua and DLL's
Re: Lua and DLL's
Yes, of course, but you'll need to supply special glue functions to interface C++ and Lua calling conventions.
For how to do this checkout the source code of TLuaInterpreter.cpp which holds these glue functions for Mudlet's Lua API. Just add your own to access your dll and then register this glue function with Lua -> TLuaInterpreter::initLuaGlobals().
Note that the glue functions need to be static functions.
For how to do this checkout the source code of TLuaInterpreter.cpp which holds these glue functions for Mudlet's Lua API. Just add your own to access your dll and then register this glue function with Lua -> TLuaInterpreter::initLuaGlobals().
Note that the glue functions need to be static functions.
Re: Lua and DLL's
Just keep in mind that dlls only work on a third of OS' that Mudlet runs on
Re: Lua and DLL's
Thank you, Vadi. Love the client, by the way.
Re: Lua and DLL's
If you're just referring to standard cdeclspec functions, you might consider a package called Alien. If you're new to Lua, I'd recommend getting the Lua for Windows installation. It installs what you may think of as a VM, an IDE, and lots of libs and provides documentation and a walkthru of the language, and samples for the libs.