lua-users home
lua-l archive

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

On 18 Jan 2008, at 10:14, RJP Computing wrote:

I would like to bind two functions that are using polymorphisms in C ++, to Lua, is this possible?

    Create( std::string path, std::string section )
Create( std::string hardware, std::string device, std::map<std::string, std::string> hardwareInitSettings )

This isn't actually polymorphism, it's function overloading.

But it's trivial, count the arguments. Or change your API to pass a table:

Create{path="foo/bar", section="top"}

This approach also makes it easy to have any argument optional.

David Dunham      Utility Infielder      GameHouse Studios
w: +1 206 926 5722   m: +1 206 769 2227
"TV--what a waste. You could be playing games, or reading a
book, for that matter." -- Greg Costikyan