-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to start with the wrapper? #144
Comments
You need to manually register the class with the The lib is headers-only by default, you only need to include "LuaIntf.h" it in your cpp, that's it. |
yeah, I understood that from the readme, but what do I compile it as? static lib? dynamic lib? how do I link the lib to the Lua after it's been compiled? |
Just like I said, it is headers-only. All you have to do is add the following line in your cpp file:
However, you still need to link with normal lua lib, please refer lua.org for more info. |
this WRAPPER is header-only, but I can use it to create C++ libraries for Lua, right? how do I compile THEM? do I compile them as static libs? as dynamic libs? how do I then use the compiled library in Lua? |
Not sure about how you use the lua, do you plan to embed lua into you app? or do you plan to create lua module? Either way, there is no separate compile step for LuaIntf, it get compiled into your cpp directly. |
it seems that you can't understand me... AFTER I include header of this wrapper in my 'myClass' and bind it using how do I compile myClass? do I compile it as static library? dynamic library? how do I use myClass from within Lua? how does Lua know where to look for myClass? I'm NOT asking about how to include your wrapper in my code, I'm asking about what to do AFTER I include it in my code, how do I compile MY code, MY library [myClass] and how do I use it from within Lua? local cl = myClass(3, "hello");
print(cl.getInt(), cl.getString());
cl.setInt(5);
cl.setString("world");
print(cl.getInt(), cl.getString()); |
haha, your question is also that i want to ask. |
Hello,
for the last 2 days I've been trying to figure out how I can use custom C++ library from within Lua and stumbled upon this wrapper, which looks like it does what I need it to do.
So I have this basic library with 1 class:
I obviously use it in C++ like this
is there any way (and if so, how?) to use it from within Lua in a similar way? like this:
Does the library has to be compiled as a static, or dynamic library?
Do I only include the wrapper and Link the class as shown in the readme?
How does the Lua find the linked library then? With C++ I have to link it while compiling, providing a path to the lib. How does this work with Lua?
I'm sorry if this is stupid question, but I've used Lua only for game scripting so far, never really used it with binding to any language, therefore I have no idea how to work with the wrapper provided. Any help is highly appreciated!
The text was updated successfully, but these errors were encountered: