feat: key pressed event interception & 'owner' input.add_callback third argument

This commit is contained in:
MihailRis
2025-01-02 20:51:43 +03:00
parent 7fce735ca1
commit b9ff1db086
17 changed files with 192 additions and 63 deletions
+16
View File
@@ -246,6 +246,22 @@ runnable lua::create_runnable(State* L) {
};
}
supplier<bool> lua::create_simple_handler(State* L) {
auto funcptr = create_lambda_handler(L);
return [=]() -> bool {
getglobal(L, LAMBDAS_TABLE);
getfield(L, *funcptr);
if (call_nothrow(L, 0)) {
bool result = toboolean(L, -1);
pop(L, 2);
return result;
} else {
pop(L);
return false;
}
};
}
scripting::common_func lua::create_lambda(State* L) {
auto funcptr = create_lambda_handler(L);
return [=](const std::vector<dv::value>& args) -> dv::value {