Ubik

Sign in to follow this  
  • entries
    101
  • comments
    122
  • views
    57830

Started Lua

Sign in to follow this  
Will F

113 views

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.
Sign in to follow this  


5 Comments


Recommended Comments

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]

Share this comment


Link to comment
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>
}

Share this comment


Link to comment
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);

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now