mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
add trackbar 'sub-consumer' for value label refresh when 'change-on-release'
This commit is contained in:
parent
0e3bd4dcac
commit
f46e4a7989
9 changed files with 65 additions and 20 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "lua/lua_engine.hpp"
|
||||
#include "../../debug/Logger.hpp"
|
||||
#include "../../coders/json.hpp"
|
||||
#include "../../util/stringutil.hpp"
|
||||
|
||||
using namespace scripting;
|
||||
|
|
@ -177,3 +178,25 @@ vec2supplier scripting::create_vec2_supplier(
|
|||
return glm::vec2(0, 0);
|
||||
};
|
||||
}
|
||||
|
||||
dynamic::to_string_func scripting::create_tostring(
|
||||
const scriptenv& env,
|
||||
const std::string& src,
|
||||
const std::string& file
|
||||
) {
|
||||
auto L = lua::get_main_thread();
|
||||
try {
|
||||
lua::loadbuffer(L, *env, src, file);
|
||||
lua::call(L, 0, 1);
|
||||
auto func = lua::create_lambda(L);
|
||||
return [func](const dynamic::Value& value) {
|
||||
auto result = func({value});
|
||||
return json::stringify(result, true, " ");
|
||||
};
|
||||
} catch (const lua::luaerror& err) {
|
||||
logger.error() << err.what();
|
||||
return [](const auto& value) {
|
||||
return json::stringify(value, true, " ");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue