0

I have a C++ function that I want to return a lua table

luabind::object getPosition(void)
{
    luabind::table=luabind::newtable(this->state);
    table["x"]=this->position[0];
    table["y"]=this->position[1];
    return table
}

The problem is that when lua calls this function, a number is returned instead of a table.

user467526
  • 517
  • 5
  • 19

1 Answers1

0

Try to use:

luabind::object getPosition(void)
{
    luabind::object result =luabind::newtable(this->state);
    result["x"]=this->position[0];
    result["y"]=this->position[1];
    return result 
}
Cosmo
  • 138
  • 5