lua-users home
lua-l archive

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


what worrys me is this small table constructors for each Object. each skill of each object will have a table.
 
so, for 100 objects I will have 300 "subtables". Is that a problem?
Is there som "smartier" way of do this? I mean, tables wich items have tables, also...
 
my game runs on a PC.

Jules Bean <jules@jellybean.co.uk> wrote:
On Mon, Aug 25, 2003 at 02:33:22PM -0300, Jose Marin wrote:
> Object{
>
> name = "object1",
> flags = F_MONSTER,
>
> itens = {
> skill_easy = { item1, item2 },
> skill_normal = { item3, item4 },
> skill_hard = { item4, item5 },
> }
>
> }
>
>
> Object is a function.
>
> I'll have dozens (almost hundreds) of objects like this.
>
> Is there som better way of do this? O Lua manges efficiently the memory?

Looks fine to me. I shouldn't worry... unless, perhaps, your game is
intended to run on an embedded platform with 64K memory or some
similar thing.

For reference, one way to improve memory usage yourself is to use
userdata and manage the memory in C. A simple way of doing this is to
use tolua and C structs. But I don't believe this is necessary for
your example.

Jules



Desafio AntiZona: participe do jogo de perguntas e respostas que vai dar
1 Renault Clio, computadores, câmeras digitais, videogames e muito mais!