Advertisement

problems embedding lua

Started by February 05, 2004 12:16 AM
40 comments, last by nekoflux 20 years, 9 months ago
interesting. Do any of these binding systems offer performance overhead in terms of speed at runtime? It sounds to me like these binding systems are the lazy man''s solution to choosing which functions should be bindable by hand.

perhaps I am misinterpreting things? do these binding systems offer any other advantages above and beyond convenience to the integrator?

curiously yours,

neko
nekoflux
They have an alpha version of tolua 5.0 if you feel brave; I''m locked into using Lua 4.0 due to the sheer amount of script I would have to re-write for Golem were I to switch, so I can not say how stable tolua 5.0 may be.

The point of these binding tools is to pre-generate all of the stack manipulations, user-type definitons and so forth necessary to allow Lua scripts to see functions, classes or objects defined in your engine code.

There may be a small bit of overhead, but there is always going to be overhead in terms of performance when implementing an embedded scripting language, and you are probably not going to see any significant improvements by laboriously structuring your bindings by hand. The automatic binding tools do what they do fairly well, without as many potential hard-to-find bugs or errors.

With tolua, you can do a little bit of editing to the header files already in your project, and feed them to the tolua executable, which will parse them and generate .cpp files which contain initialization functions that handle all of the binding. Cleaning up the header files is a trivial task, though it does add an extra step, as you have to edit the header file and feed it to tolua again when you add a new function or class.

I have heard good things about LuaBind as well, though I have not used it.

Don''t underestimate the convenience to the integrator aspect. My scripting interface for Golem currently runs in excess of 350 various functions, as well as over a dozen classes. That is a lot of binding code to generate by hand, and a lot of potential for error. Of course, I am a Linux programmer, and part of the Unix philosophy is to never do anything yourself if you can write a tool to do it faster and more efficiently.

And, no, I don''t have a project page, just the homepage for my game, Golem. I''ve been working on various tutorials and articles, most of which I''ll probably put up on a page somewhere, but that work takes a back-seat to so many other things that it may be awhile.

Golem

Blender--The Gimp--Python--Lua--SDL
Nethack--Crawl--ADOM--Angband--Dungeondweller

This topic is closed to new replies.

Advertisement