lua-users home
lua-l archive

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


I am trying to use lunar.h from , but i am not able to call it from my lua code.

Here is the scenario

I have a cpp class Parser which is derived from BaseModule. BaseModule has two functions with signature
    int set_mapping(lua_State *L)  and     int get_mapping(lua_State *L)
I am creating the Parser object in cpp and want to let my script call these two methods from script

so i used the following code in my constructor

    int parser_instance = Lunar<Parser>::push(script_land.L,this);

Also i have

const char Parser::className[] = "Parser";

#define method(class, name) {#name, &class::name}

Lunar<Parser>::RegType Parser::methods[] = {
  method(Parser, get_mapping),
  method(Parser, set_mapping),

but when i try to print(reader:get_mapping) i get and error : attempt to call a nil value

How can i possibly debug this ? I also have a constructor function of the signature Parser(lua_State *L) but that does nothing. Can this be the problem

I have also tried this
a = reader:new()
print (a)

this gives me a output something like this

Parser (0xbfa2c498)

Please help me.


Robert Benchley  - "Drawing on my fine command of the English language, I said nothing."