ChaiScript troubles

Posted by Ockonal on Stack Overflow See other posts from Stack Overflow or by Ockonal
Published on 2010-03-23T18:07:04Z Indexed on 2010/03/23 18:43 UTC
Read the original article Hit count: 378

Filed under:
|
|

Hello guys, I'm using script language ChaiScript with c++ and Qt. I've defined such function:

void ChaiPainter::drawRectangle(QPainter *painter, int x, int y, int height, int width)
{
    painter.drawRect(x, y, width, height);
}

And in application paint-event:

void MainWindow::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);

    chaiPainter->mChai.add(chaiscript::var(&painter), "painter");
    chaiPainter->mChai.add(chaiscript::fun(&ChaiPainter::drawRectangle), "drawRect");

    chaiPainter->mChai("drawRect(painter, 5, 5, 100, 100)");
}

The error is:

'chaiscript::Eval_Error' what(): Error: "No matching function to dispatch to with function 'drawRect'" during evaluation at (1, 1)

What I do wrong?

© Stack Overflow or respective owner

Related posts about chaiscript

  • ChaiScript troubles

    as seen on Stack Overflow - Search for 'Stack Overflow'
    Hello guys, I'm using script language ChaiScript with c++ and Qt. I've defined such function: void ChaiPainter::drawRectangle(QPainter *painter, int x, int y, int height, int width) { painter.drawRect(x, y, width, height); } And in application paint-event: void MainWindow::paintEvent(QPaintEvent… >>> More

  • C++ Game Library for SVG Based Game

    as seen on Game Development - Search for 'Game Development'
    I'm looking into building a cross-platform opensource 2D RPG style game engine for ChaiScript. I want to be able to do all of the graphics with SVG and need joystick input. I also need the libraries I use to be opensource and compatible with the BSD license. I'm familiar with allegro, ClanLib,… >>> More

Related posts about c++