Calendar

September 2010
M T W T F S S
« Jan    
 12345
6789101112
13141516171819
20212223242526
27282930  

Lua / Luabind

The following code shows the small demo I created to test if the luabind-0.8.1 library worked for me.

main.cpp

extern "C"
{
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
}

#include <luabind/luabind.hpp>

#include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;

class Unit
{
private:
string name;
int maxHealth;
int health;

public:
Unit() :
name("unit"),
maxHealth(10),
health(10)
{
}

Unit(const Unit& unit) :
name(name),
maxHealth(maxHealth),
health(health)
{
}

const char* getName() const
{
return name.c_str();
}

void setName(const string& name)
{
this->name = name;
}

int getHealth() const
{
return health;
}

void setHealth(int health)
{
this->health = health;
}

};

class UnitManager
{
private:
map<string, Unit*> [...]