lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> From:
>The way I see it, it makes more sense for the higher-level
> language Lua to be the 'host' language from which you make calls to
> foreign libs, than to have the lower-level language (C) be the 'host'
> and embedding Lua. I *think* I am missing something cool here, but I
> can't really put my finger on it... can anyone give me an example where
> embedding Lua was a better option than extending it?
> darren
I think an example of embedding vs. extending Lua is the C++ game engine I'm working on. The C++ part of the engine is over %80 of the way done, and it all works well.
It's about 3000-4000 lines of code, and it has a lot of functions. In this case, it is much easier to bind a lot these functions to Lua.
I use Luna to bind all of my C++ classed to Lua. For me, it's much easier that way; I don't have to bother editing all this code creating by something similar to ToLua, and I can really control the functions
that used from HGE (rendering) and Box2D (physics), ect.
I think in all scenarios where you don't have all the C/C++ stuff coded, it's best to make some C/C++ functions that get added to Lua. Then you can build the rest of you Lua stuff off of that.
I'm even going to add a lot of extra Lua code based on the bound Lua code for my C++ engine, just to make it easier to use.
I hope this helps,
--Sgt. Sparky


Color coding for safety: Windows Live Hotmail alerts you to suspicious email. Sign up today.