feat: 'edited' property reset & add 'oncontrolkey' textbox callback

This commit is contained in:
MihailRis 2025-03-12 19:51:22 +03:00
parent fb18442322
commit 3a4b334d0b
14 changed files with 88 additions and 5 deletions

View file

@ -36,6 +36,28 @@ static lua::State* process_callback(
return nullptr;
}
key_handler scripting::create_key_handler(
const scriptenv& env, const std::string& src, const std::string& file
) {
return [=](int code) {
if (auto L = process_callback(env, src, file)) {
int top = lua::gettop(L);
if (lua::isfunction(L, -1)) {
lua::pushinteger(L, code);
lua::call_nothrow(L, 1);
}
int returned = lua::gettop(L) - top + 1;
if (returned) {
bool x = lua::toboolean(L, -1);
lua::pop(L, returned);
return x;
}
return false;
}
return false;
};
}
wstringconsumer scripting::create_wstring_consumer(
const scriptenv& env, const std::string& src, const std::string& file
) {