lua-users home
lua-l archive

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


I have a weird error in code generated by swig. Here is the .i file:

%module GameEntity
%include <std_string.i>
%include <../include/GameEntity.h>
%{
#include "GameEntity.h"
%}

This is the class:

class BaseStats {
    public:
        int stats[stLUCK];
        //int  &operator[]  ( int index) {return stats[index];};
        int __getitem__(int i)  const ; // i is the index, returns the data
        void __setitem__(int i,int d) {stats[i]=d;}; // i is the index,
d is the data
};

So, from lua scripts I can do:

entity.stats[GameEntity.stSTR]=19;

Until a few days this was working fine, but now  Im getting an error:
Error in __setitem__ (arg 2), expected 'int' got 'nil'
i really have no idea about what did I change to produce this. As I
said, this worked perfectly, until last week, and I didnt touched the
related code, so I guess I have a problem in some place, but I have no
idea about where to search. Can somebody suggest me something?


-- 
Roger D. Vargas
Gentoo Linux 2008.0
Using Gentoo Linux 2008.0, Ogre 1.6.2, fglrx
Powered by Core 2 E4500 2.2GHz, 2Gb RAM, Radeon HD4770
http://gpnfn.blogspot.com, The news for game programming newbies


		
______________________________________________ 
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 
http://es.voice.yahoo.com