lua版本怎么创建一个控制台

我用的是cocos2dx 3.10 lua版本,我想把错误的信息生成一个新的控制台,然后直接打印到上面!但是lua好像没找到这个实现方式,,求解!!!!!!!!!!!!!!!!!!

自己回答自己的吧!

#define USE_WIN32_CONSOLEint APIENTRY _tWinMain(HINSTANCE hInstance,
 HINSTANCE hPrevInstance,
 LPTSTR    lpCmdLine,
 int       nCmdShow)
{
 UNREFERENCED_PARAMETER(hPrevInstance);
 UNREFERENCED_PARAMETER(lpCmdLine);




#ifdef  USE_WIN32_CONSOLE
 AllocConsole();
 freopen("CONIN$", "r", stdin);
 freopen("CONOUT$", "w", stdout);
 freopen("CONOUT$", "w", stderr);


#endif //  USE_WIN32_CONSOLE


    auto simulator = SimulatorWin::getInstance();
    return simulator->run();


}


```