This function periodically polls the script debugger to check for user actions.
Parameter | Description |
---|---|
frequency | maximum frequency of the action, in milliseconds |
For script debugging to work, the debugger must be enabled by running "Scripts/Modules/Debugger.lua".
If you don't periodically call this function, your application will not detect new breakpoints as they are set in the IDE.
This shows a typical setup for the C++ side of a Lua program.
#include "UltraEngine.h"
using namespace UltraEngine;
int main(int argc, const char* argv[])
{
//Get command-line options
auto cl = ParseCommandLine(argc, argv);
//Enable script debugging if the -debug switch is specified
if (cl["debug"].is_boolean() and cl["debug"] == true)
{
RunScript("Scripts/Modules/Debugger.lua");
}
//Create a timer
auto timer = CreateTimer(490);
//Poll the debugger every timer tick
ListenEvent(EVENT_TIMERTICK, timer, std::bind(&PollDebugger, 500));
//Run the main script
RunScript("Scripts/Main.lua");
return 0;
}