printing to stdout

Josh Stratton <[email protected]> Mon, 8 Aug 2011 18:58:28 -0700
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <CAPVmgLhMveqtKXfHOQR_GW0cOvVQ5jdr8ig-Bsy+T6VXmO-wjw@mail.gmail.com>
I'm having issues printing to stdout from lua.  I could have sworn it
was working for earlier cases.  I can read back a value from a
function, but doing a print statement doesn't display anything.  Is
luabind writing to some other location?  I thought I had it going to
stdout when I first set it up...

    // Create a new lua state
    lua_State *myLuaState = lua_open();

    // Connect LuaBind to this lua state
    luabind::open(myLuaState);

    // Define a lua function that we can call
    luaL_dostring(myLuaState,
                  "function add(first, second)\n"
                  "  return first + second\n"
                  "end\n"
                    );

    std::cout << "Result: " << luabind::call_function<int>(myLuaState,
"add", 2, 3) << std::endl;

//luaL_dostring(myLuaState, "_meshImporters = {}");

    // read
    luaL_dostring(myLuaState, "print('test')");

------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev