Why lua?

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
mattheweston
Chaos Rift Junior
Chaos Rift Junior
Posts: 200
Joined: Mon Feb 22, 2010 12:32 am
Current Project: Breakout clone, Unnamed 2D RPG
Favorite Gaming Platforms: PC, XBOX360
Programming Language of Choice: C#
Location: San Antonio,Texas
Contact:

Why lua?

Post by mattheweston »

I know I could spend hours upon hours researching on the internet, but in doing that I feel I might just be scratching the surface and I thought this might be a good topic for discussion.

I have never used lua so, please forgive me if this seems like a stupid post. So tell me about lua.

How are you using it? What it everything you thought it would be? Are there other things you can envision it being used for that you haven't taken advantage of yet?
Image
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

Re: Why lua?

Post by LeonBlade »

I'll most likely be using Lua myself, either that or Ruby.
It's used as a scripting engine for your game.
For example, NPCs would use Lua scripting and other things like that.
There's no place like ~/
User avatar
Arce
Jealous Self-Righteous Prick
Jealous Self-Righteous Prick
Posts: 2153
Joined: Mon Jul 10, 2006 9:29 pm

Re: Why lua?

Post by Arce »

Allrighty, I'm not quite sure what your question is asking...

Do you want to know "Why use a scripting language period?" or "Why use Lua as my scripting language as opposed to others?"

Or do you just think "Lua" is a person, and you're consulting him about the wonders of life? ("Why, Lua...? Why?") :mrgreen:

^ All of the above are legitimate points of discussion.
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
mattheweston
Chaos Rift Junior
Chaos Rift Junior
Posts: 200
Joined: Mon Feb 22, 2010 12:32 am
Current Project: Breakout clone, Unnamed 2D RPG
Favorite Gaming Platforms: PC, XBOX360
Programming Language of Choice: C#
Location: San Antonio,Texas
Contact:

Re: Why lua?

Post by mattheweston »

It's a combination of your questions. Why use a scripting language and why use lua over say perl or some other scripting language.
Image
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Why lua?

Post by Falco Girgis »

I'm not going to answer the question "why embed a scripting language into an engine." I have posted entire 2 page philosophies in response to this question and I'm sure you'll be able to find them by doing a forum search. It all boils down to extensibility.

I will, however, answer the question as to why we chose Lua in particular.

Lua is fast, lightweight, and was designed specifically to be an embedded scripting language. The entire interpreter compiles natively with ANSI C, and comes with its own full-fledged C API. Other scripting languages (Perl, Python, Ruby, etc) are full-blown standalone programming languages that are all waaay larger and way slower than Lua. While they can be embedded into C/++ applications, this wasn't their purpose (whereas Lua was designed for this) and take quite a bit of glue code to get C/++ communicating with them.
mattheweston
Chaos Rift Junior
Chaos Rift Junior
Posts: 200
Joined: Mon Feb 22, 2010 12:32 am
Current Project: Breakout clone, Unnamed 2D RPG
Favorite Gaming Platforms: PC, XBOX360
Programming Language of Choice: C#
Location: San Antonio,Texas
Contact:

Re: Why lua?

Post by mattheweston »

so riddle me this...does lua act like a "wrapper" around your code that allows you to call your code external to the application?
Image
K-Bal
ES Beta Backer
ES Beta Backer
Posts: 701
Joined: Sun Mar 15, 2009 3:21 pm
Location: Germany, Aachen
Contact:

Re: Why lua?

Post by K-Bal »

mattheweston wrote:so riddle me this...does lua act like a "wrapper" around your code that allows you to call your code external to the application?
You can call C/C++ functions from Lua and Lua functions from C/C++.
Post Reply