Topic: How to use lua libraries in Maratis?

I know how to use the dofile() function to access lua functions from another file, but how would I go about using external libraries not my own? Are there any limitations? Seeing as this is a game engine, might some of the functions not work?

For instance, there is a library called GLua, and I quote:

''GLua] (5.1) - a library with classes and functions useful for scripting OpenGL applications, particularly prototyping GLSL shaders. Pure Lua."

How would I use it?

Edit, well, after looking through the site I found that quote, it says actually noted that Maratis does not fit to Libraries and Bindings (whatever that means):

http://lua-users.org/wiki/LuaGraphics

What about GUI libraries?

Last edited by Tutorial Doctor (2013-10-21 14:43:08)

Re: How to use lua libraries in Maratis?

Generally, libraries could be released on the internet in this forms:
-a pack full of source files that you can directly compile
OR
-a DLL file (.dll) with a header file (.h) and an import library (.lib).

In the first case, you should create a C++ game plugin for Maratis and add the source files that you've downloaded in your project. Depending on various things you may get some warnings or even some errors during compilation and so it requires a bit of work to "adjust" the code to make it work or to add the necessary preprocessor directives.

In the second case, your source files will be the headers (.h), but the content of every function will not be in the source files but it will be inside the DLL (.dll) already compiled. So to compile you also need to include the import library (.lib) in your project.
Then your final executable (.exe) or, in this case, your Maratis plugin DLL (.dll), would have to run in the same folder of the DLL, so when you release your game you would have to release the DLL too.

The second case is the same scenario that you find when creating a Maratis plugin in C++: you have the Maratis headers and the MCore.lib and MEngine.lib import libraries.


The problem with the second case is that if the DLL (and the .lib) are compiled with say MinGW, it won't work if you compile your project with a different compiler, e.g. the Visual Studio one.


In any case you have to bother with C++, you can't use other DLLs with Lua.

Re: How to use lua libraries in Maratis?

I am tired of C++ rearing it's ugly head! haha. I wish someone would make a very easy to understand tutorial on C++ (Seen plenty, but not one that is good enough for my simple mind.).

I have no idea what you just typed actually, but I guess if I decide to try C++ again, I will be able to refer to this post.

I have a feeling that the reason I don't know what is going on in C++ when I see someone else's code is that the way people write their code might be confusing.

Having variables named:

c=

a_cinq=

etc. haha.

I am surprised I was able to run a game in full screen by creating a .bat file. haha.

Thanks 255.

Re: How to use lua libraries in Maratis?

Reading other's code it's not ideal when you are still learning the basics.
Most of the time they use "advanced" syntax. It's better to start from square one, learning the basics, making some simple programs and then start learning object oriented programming applied to C++.
Only when you're done, you can read other's code and what you don't get you can examine in depth about.
I'm surprised you say there's no good tutorial. There is so much on the net that there must me something which fits you.
There are tutorials which assumes you already know certain things and there are others that starts from the very basics.