Jump to content

Making Lua custom API's (with Leadwerks C++) and using them in Leadwerks editor


1Garrett2010
 Share

Recommended Posts

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!

Link to comment
Share on other sites

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

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...