1Garrett2010 Posted October 13, 2014 Share Posted October 13, 2014 Hallo, I searched the forum for this before to avoid asking questions already answered, I didn't find anything on this. Basically I'm finishing a bitmap font editor with C++ and DirectX, and have done a C++ class to load and display text with a font done in my own editor. Simply I wish to know if its possible to expand Leadwerks Lua API's (using Leadwerks C++) in order to use them in Leadwerks editor Lua scripts. Of course I would replace the DirectX calls I currently use to display my font with Leadwerks C++ API image writing calls. If this is possible its awesome. Thank you! Quote Link to comment Share on other sites More sharing options...
Guppy Posted October 13, 2014 Share Posted October 13, 2014 It is possible, there are various way of doing it one is outlined here; http://www.leadwerks.com/werkspace/blog/138/entry-1288-pushing-complex-lua-tables-from-c/ Not mentioned in the blog, but in the source file are additional classes "luaMemberFunction" and "luaFunction" Which lets you add functions to your lua table. Alternatively you could skip the that and just push the functions directly with (lua_pushcclosure), but I think wrapping them in a global table will do much to prevent name clashes and it looks prettier. if you do chose to to go the manual way you should remeber to use Leadwerks::Interpreter::L Quote System: Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k Link to comment Share on other sites More sharing options...
1Garrett2010 Posted October 13, 2014 Author Share Posted October 13, 2014 Really very good to read from you that expanding Lua is possible! Soon I will use the code you posted. Thank you. Quote 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.