If you want the user to enter an expression (for example, 1+2or a+math.sqrt(b)), before passing it to the interpreter, you must add a "return":
const std::string cmdStr = "return " + m_OutputWindow->GetLineText(line-1).ToStdString();
int err = luaL_loadbuffer(luastate, cmdStr.c_str() , cmdStr.size(), "line")
|| lua_pcall(luastate, 0, 0, 0);
, , , (, a=1; b=2). , , , , . ; , , . (-) (-), :
a=4
return 1+2
return math.sqrt(a)
print('hi')
a
4
1+2
math.sqrt(a)
'hi'
- . , lua_tostring , . , lua_tostring , , , ret=func(whatever).