Josh Posted January 10, 2017 Share Posted January 10, 2017 What it does: Scans all header files, generates a ToLua++ pkg file, and generates Lua binding code. How to use: Extract all files to your source code directory and run tolua++.bat To expose a class you must add //lua after the class and after any members or methods you want to expose. Example: class foo//lua { public: int thing;//lua void bar();//lua }; tolua++.zip 1 5 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
shaochun Posted February 4, 2017 Share Posted February 4, 2017 How do we make use of these two generated files? Do they have to be added into Visual Studio Project? Quote Link to comment Share on other sites More sharing options...
Josh Posted February 4, 2017 Author Share Posted February 4, 2017 Yes, they have to be added into your project. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
reepblue Posted February 4, 2017 Share Posted February 4, 2017 Thank you so much! Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Charrua Posted July 21, 2017 Share Posted July 21, 2017 is there a similar tool for linux? Quote Paren el mundo!, me quiero bajar. Link to comment Share on other sites More sharing options...
reepblue Posted July 21, 2017 Share Posted July 21, 2017 Crazycarpet made one with more features in C#. It prob can be compiled for Linux using Mono. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Crazycarpet Posted July 21, 2017 Share Posted July 21, 2017 15 hours ago, Charrua said: is there a similar tool for linux? https://bitbucket.org/Codeblockz/toluapkggenerator2 This should compile on Monodevelop 2.2 or greater, although I haven't tested it! it adds more support like enumerations, methods/variables that are just in namespaces and not classes, size_t and other fixed size integer support, nested namespaces and classes (Although the #define you'll see by default makes it generate classes outside of all modules (i.e: hidden behind no Lua table), and methods in namespaces are only in the lowest namespace. (This is only by default. You can make it generate the full hierarchy in Lua by commenting out the define ```MINIMAL_NAMESPACE_NESTING``` at the top of "Program.cs". Also it says "Unions are unsupported", but this is only partially true, look what Josh did in Vec3.h to expose the unions using a comment like: //float x, r, y, g, z, b;//lua The same works here. I strongly recommend you use this along with it: https://bitbucket.org/Codeblockz/fixtoluanamespaces The instructions for the generator explain how. to add it (Simply compile & drop in same directory as ToLuaPkgGenrator2 executable). It's (I think) like Josh's FixGlueCode or whatever script. if I were to tag something like class AClass { //lua MyNamespace::SomeClass member; //lua } This second application will go through the generated ToLua bindings and rename "MyNamespace::SomeClass" to "SomeClass" in strings, not in the code... making sure ToLua++ knows that they represent the same class. Why don't I make the generator simply not write this preceding namespace to the generated pkg files? Well because ToLua++ still needs it to be named this way in code and the generator only adds 'using' statements for namespaces based on hierachy, it currently doesn't support using statements being generated for cases like this as it'd be much more complicated to handle all scenarios. The second application was the simpler solution. You'll have to write your own bash script however that's equivalent to the batch script provided if you want to use this on Linux! Should be easy. If you do end up getting it running on Linux a share of the Bash would be appreciated, but not necessary! (As one of my projects unrelated to LE uses it and will need it to work on Linux as well.) Quote Link to comment Share on other sites More sharing options...
Charrua Posted July 21, 2017 Share Posted July 21, 2017 thank's for your time and generator yesterday i wrote a very simple class to start doing some tests and found that there is a generator for windows and as i have to write th .pkg by hand (for a simple test class is not so much work) i just be curios about the same tool for linux. if I get it to work, in case i use it i'll will update here or on your thread, but, you know, if i already make it work by hand... and my class will not be so much complicated... chances are that i let it as is for a while thank's again Juan Quote Paren el mundo!, me quiero bajar. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.