even more boilerplate code
This commit is contained in:
@@ -51,6 +51,49 @@ wstringconsumer scripting::create_wstring_consumer(
|
||||
};
|
||||
}
|
||||
|
||||
wstringsupplier scripting::create_wstring_supplier(
|
||||
int env,
|
||||
const std::string& src,
|
||||
const std::string& file
|
||||
) {
|
||||
return [=](){
|
||||
if (processCallback(env, src, file)) {
|
||||
state->callNoThrow(0);
|
||||
auto str = state->tostring(-1); state->pop();
|
||||
return util::str2wstr_utf8(str);
|
||||
}
|
||||
return std::wstring(L"");
|
||||
};
|
||||
}
|
||||
|
||||
boolconsumer scripting::create_bool_consumer(
|
||||
int env,
|
||||
const std::string& src,
|
||||
const std::string& file
|
||||
) {
|
||||
return [=](bool x){
|
||||
if (processCallback(env, src, file)) {
|
||||
state->pushboolean(x);
|
||||
state->callNoThrow(1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
boolsupplier scripting::create_bool_supplier(
|
||||
int env,
|
||||
const std::string& src,
|
||||
const std::string& file
|
||||
) {
|
||||
return [=](){
|
||||
if (processCallback(env, src, file)) {
|
||||
state->callNoThrow(0);
|
||||
bool x = state->toboolean(-1); state->pop();
|
||||
return x;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
doubleconsumer scripting::create_number_consumer(
|
||||
int env,
|
||||
const std::string& src,
|
||||
|
||||
Reference in New Issue
Block a user