Started Lua

posted in Ubik
Published June 24, 2005
Advertisement
I've been playing around with using Lua as a scripting language for NPCs and possibly even some AI for the monsters.

Didn't get too much done, just got it embedded in a small C++ app with the ability to send and retrieve variables that a lua script processes. Next up is learning how to register some C++ functions and calling them from within a lua script. Looks easy enough.

Also might look around and see what other scripting languages that can be embedded in a C++ app are out there, and decide which one to use.
Previous Entry Added XML support
Next Entry Kittens
0 likes 5 comments

Comments

BDePesa
I liked the look of AngelScript.. I have yet to try it though. It's an alternative to Lua :).
June 24, 2005 10:14 PM
noaktree
I've used Lua on several occasions and have been quite happy with it.
June 24, 2005 10:33 PM
paulecoyote
was it pretty easy to get in to your application? I dont need a scripting language *yet* but I can see the time when I would. If you get in to Lua, would you mind pasting any useful urls you may have used for reference in to this journal?

Cheers [smile]
June 25, 2005 03:08 AM
Will F
It was pretty easy, downloading lua and getting a hello world script running from a C++ app took maybe an hour. Getting a lua script to do something a bit more interesting wasn't much harder.

The two references i've used are this article here at gamedev.net and the book Core Techniques & Algorithms in Game Programming by Daniel Sanchez-Crespo. The book only has 4 or 5 pages specifically on lua, but it's well written.

The biggest annoyance so far is that anytime you want to include lua.h in a C++ file you have to do it like this:
extern "C"
{
 #include <lua.h>
}

June 25, 2005 02:44 PM
Will F
One problem i've noticed with the tutorial is that it appears to be using an older version of lua (4 I think), so it expects the function lua_open() to be:

lua_State *lua_open (int initialStackSize);

Where in lua 5.0.2 (what i'm using) it appears to have been changed to:

lua_State *lua_open (void);
June 26, 2005 12:38 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

XNA

1529 views

...

642 views

Physics demo

1255 views

Console launch...

1091 views

New project

1450 views

b day

1108 views

Source control

1277 views

More on Inform 7

1062 views

Logging

1208 views

Lines of code

1274 views
Advertisement