mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 03:21:49 +00:00
add 'set-breakpoint', 'remove-breakpoint' commands
This commit is contained in:
parent
95f30da49b
commit
5972bc769b
6 changed files with 114 additions and 2 deletions
|
|
@ -279,6 +279,33 @@ static int l_debug_breakpoint(lua::State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int l_debug_pull_events(lua::State* L) {
|
||||
if (auto server = engine->getDebuggingServer()) {
|
||||
auto events = server->pullBreakpointEvents();
|
||||
if (events.empty()) {
|
||||
return 0;
|
||||
}
|
||||
lua::createtable(L, events.size(), 0);
|
||||
for (int i = 0; i < events.size(); i++) {
|
||||
const auto& event = events[i];
|
||||
lua::createtable(L, 3, 0);
|
||||
|
||||
lua::pushinteger(L, static_cast<int>(event.type));
|
||||
lua::rawseti(L, 1);
|
||||
|
||||
lua::pushstring(L, event.source);
|
||||
lua::rawseti(L, 2);
|
||||
|
||||
lua::pushinteger(L, event.line);
|
||||
lua::rawseti(L, 3);
|
||||
|
||||
lua::rawseti(L, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void initialize_libs_extends(lua::State* L) {
|
||||
if (lua::getglobal(L, "debug")) {
|
||||
lua::pushcfunction(L, lua::wrap<l_debug_error>);
|
||||
|
|
@ -296,6 +323,9 @@ void initialize_libs_extends(lua::State* L) {
|
|||
lua::pushcfunction(L, lua::wrap<l_debug_breakpoint>);
|
||||
lua::setfield(L, "breakpoint");
|
||||
|
||||
lua::pushcfunction(L, lua::wrap<l_debug_pull_events>);
|
||||
lua::setfield(L, "__pull_events");
|
||||
|
||||
lua::pop(L);
|
||||
}
|
||||
if (lua::getglobal(L, "math")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue