lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Thanks for the tip!

I would like to have Lua files with configurations for
my game. For example:

In "enemy.lua"

enemy = {

 {
   name = "ogre",
   health = 30,
   skill = 10,
   sounds = { "ogresond1", "ogresound2"},
 },
 {
   name = "orc",
   health = 10,
   skill = 20,
   sounds = { "orcsond1", "orcsound2"},

 }
-- and so on
}


In C++, I have this struct

struct CEnemy{
 string name;
 int health;
 int skill;
 string sounds[MAX_SOUND];
}

CEnemy EnemyList[MAX_ENEMY];


My problem is how to use the file "enemy.lua" to fill
the struct EnemyList.



______________________________________________________________________

Yahoo! Messenger - Fale com seus amigos online. Instale agora! 
http://br.download.yahoo.com/messenger/