It's all in your head, Part 9
- Chris
- Introversion Staff

- Posts: 1172
- Joined: Sat Nov 25, 2000 7:28 pm
- Location: Cambridge, UK
- Contact:
Stiill, could I ask you some questions about your usage of Lua?
Specifically id love to know if you used lua in a class based way with objects, methods, inheritance etc through metatables, or if you just used it by passing in object pointers to all your functions with no real OO programming.
Id also love to know if you ran a single Lua instance for the whole game, or if you created seperate Lua instances for each game object, or some other method.
Specifically id love to know if you used lua in a class based way with objects, methods, inheritance etc through metatables, or if you just used it by passing in object pointers to all your functions with no real OO programming.
Id also love to know if you ran a single Lua instance for the whole game, or if you created seperate Lua instances for each game object, or some other method.
Here's an example of embedding stackless Python in C++, using Boost.
http://svn.python.org/view/stackless/sa ... iew=markup
I love the idea of the concurrency, etc of stackless Python, but I do like the "simple, lightweight" Lua approach... might be more practical.
Keep us posted on what you guys end up using/why. I'm a beginning dev wondering if I can get some of my less-technical cohorts to help with logic by giving them a scripting language.
http://svn.python.org/view/stackless/sa ... iew=markup
I love the idea of the concurrency, etc of stackless Python, but I do like the "simple, lightweight" Lua approach... might be more practical.
Keep us posted on what you guys end up using/why. I'm a beginning dev wondering if I can get some of my less-technical cohorts to help with logic by giving them a scripting language.
mcnicholls wrote:I had breifly forgotten about stackless, but i would think it is perfect for this kind of project. Coroutines would allow you to create a lot of game objects that all run concurrently.
Although i was reading a little about lua and it seems it supports coroutines as well. Is that true?
It is (at least, Lua 5.x does; I haven't used 4.x or earlier versions). See the overview and library reference.
Chris Delay wrote:Lua requires the C++ programmer to directly manipulate a shared stack to communicate with your scripts, which is analogous to programming while sitting on a pile of volatile explosives while spiders crawl over your body.
Granted that talking directly to the stack isn't exactly hugs and kittens, but I don't think it's that bad. And it follows the general Lua approach of giving you small, flexible building blocks rather than prefab solutions - the stack API is simple and consistent, which makes it easy to write higher-level functions which abstract whatever you need to do with it into a more comfortable interface. I believe there's already some C++ libraries that do just this, in fact.
As far as OO in Lua goes, it's kind of a love/hate thing for me. On the one hand, you can roll you own, which means pretty much whatever object system maps most naturally to the project, you can do it, and often pretty easily. On the other hand, you have to roll your own, so there's no consensus on how a Lua object system should work and it means you can't just plonk down and start writing objectified code like in (say) Python.
On the whole, though, I prefer it. It usually doesn't take long to write yourself an object system, and I find the added flexibility is well worth the requirement to do so.
Python FTW!!!
After 5 years of being a heavy uplink fan, I have finally registered!
Chris:Python is not actually that scary when it comes to syntax...
The whitespace syntax can seem strange,but is only natural...
After all,You've been putting indentation in your code for years now,haven't you?
I don't myself have any knowledge of embedding python in C or C++ so I can't really give you any info there...
Because I program in python and not lua,I am obviously in support of it,but you choose what feels natural...
Also LUA was designed for game scripting...
What will the pricetag for subversion be?
P.S.Any GNOME users can check out my Uplink metacity theme...http://gnome-look.org/content/show.php/Uplink+GTK+and+Metacity+Theme?content=75180
P.S.S.I put the license under proprietary so that people would know that Introversion still has all rights over the content...
Chris:Please don't sue me...
Chris:Python is not actually that scary when it comes to syntax...
The whitespace syntax can seem strange,but is only natural...
After all,You've been putting indentation in your code for years now,haven't you?
I don't myself have any knowledge of embedding python in C or C++ so I can't really give you any info there...
Because I program in python and not lua,I am obviously in support of it,but you choose what feels natural...
Also LUA was designed for game scripting...
What will the pricetag for subversion be?
P.S.Any GNOME users can check out my Uplink metacity theme...http://gnome-look.org/content/show.php/Uplink+GTK+and+Metacity+Theme?content=75180
P.S.S.I put the license under proprietary so that people would know that Introversion still has all rights over the content...
Chris:Please don't sue me...
Clearly no existing language is good enough for SUBVERSION; you must first create your own. Only then can SUBVERSION emerge in its most sublime state of perfection.
There's good precedent for this sort of thing; Donald Knuth wanted to write a book on compilers, but he felt there was no adequate introduction to the basics of computer science necessary as a prerequisite, so he had to write The Art of Computer Programming first (three and a bit volumes so far, all massive, and no end in sight).
There's good precedent for this sort of thing; Donald Knuth wanted to write a book on compilers, but he felt there was no adequate introduction to the basics of computer science necessary as a prerequisite, so he had to write The Art of Computer Programming first (three and a bit volumes so far, all massive, and no end in sight).
brog wrote:There's good precedent for this sort of thing; Donald Knuth wanted to write a book on compilers, but he felt there was no adequate introduction to the basics of computer science necessary as a prerequisite, so he had to write The Art of Computer Programming first (three and a bit volumes so far, all massive, and no end in sight).
Oblig. xkcd

Re: It's all in your head, Part 9
Chris wrote:Lua is the next contender. Lua is also used by some fairly impressive commercial games, including SimCity 4, World of Warcraft, FarCry, Psychonauts and a ton more. Lua is relatively new compared to Python, and this does cause it some problems. The API is still changing and being rewritten yearly, meaning a lot of the documentation and examples on the internet are already out of date and refuse to work. In my experiments Lua has proved to be much simpler to embed in C++, however it is much more down to the wire – Lua requires the C++ programmer to directly manipulate a shared stack to communicate with your scripts, which is analogous to programming while sitting on a pile of volatile explosives while spiders crawl over your body. Fundamentally Lua is designed to be embedded and controlled by C++, whereas Python wants to embed and control C++ in itself. Lua also falls over itself when you start thinking about classes and Object Oriented programming – it can do it, but only through some tricks and hacks. When combined with a couple of extra libraries – Boost and LuaBind, Lua starts to become much more interesting, and takes on much of the power of Python.
Here’s an example Lua script, so you can compare. I find it to be more “readable” than Python, but that’s just a subjective opinion I think.
http://lua-users.org/wiki/SciteCleanDocWhitespace
Chris, I have played many games using Lua scripts, and while I find these feats to be impressive (It's how Excalibur: Morgana's Revenge put vehicles in one level, Vendetta Online uses them for impressive plug-ins) I have never tried making a game of this scale. (I tried to make text games in Ruby, but they all flopped) The point is, many, many people know Lua and you will probably get a much larger mod community if you use that. (Of course, this is based on my experiences, several games I play use Lua for mods, but I have barely heard of Python)
- shinygerbil
- level5

- Posts: 4667
- Joined: Wed Dec 22, 2004 10:14 pm
- Location: Out, finding my own food. Also, doing the shinyBonsai Manoeuvre(tm)
- Contact:
Re: It's all in your head, Part 9
I think you are in the minority there.skull13 wrote:I have barely heard of Python
Here is my signature. Make of it what you will.

- shinygerbil
- level5

- Posts: 4667
- Joined: Wed Dec 22, 2004 10:14 pm
- Location: Out, finding my own food. Also, doing the shinyBonsai Manoeuvre(tm)
- Contact:
Re: It's all in your head, Part 9
shinygerbil wrote:I think you are in the minority there.skull13 wrote:I have barely heard of Python
As a point of reference. I don't think the deciding issue will ever be popularity.
Re: It's all in your head, Part 9
KingAl wrote:shinygerbil wrote:I think you are in the minority there.skull13 wrote:I have barely heard of Python
As a point of reference. I don't think the deciding issue will ever be popularity.
Epic up arrows for LUA
Who is online
Users browsing this forum: No registered users and 4 guests




