Merge branch 'main' into curl

This commit is contained in:
MihailRis
2024-11-26 12:48:14 +03:00
73 changed files with 366 additions and 136 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ static fs::path resolve_path(const std::string& path) {
static fs::path resolve_path_soft(const std::string& path) {
if (path.find(':') == std::string::npos) {
return path;
return fs::u8path("");
}
return engine->getPaths()->resolve(path, false);
}
+4 -1
View File
@@ -334,7 +334,9 @@ static int p_set_interval(UINode* node, lua::State* L) {
static int p_get_content_offset(UINode* node, lua::State* L) {
return lua::pushvec(L, node->getContentOffset());
}
static int p_get_id(UINode* node, lua::State* L) {
return lua::pushstring(L, node->getId());
}
static int p_get_color(UINode* node, lua::State* L) {
return lua::pushcolor(L, node->getColor());
}
@@ -390,6 +392,7 @@ static int l_gui_getattr(lua::State* L) {
std::string_view,
std::function<int(UINode*, lua::State*)>>
getters {
{"id", p_get_id},
{"color", p_get_color},
{"hoverColor", p_get_hover_color},
{"pressedColor", p_get_pressed_color},
@@ -156,12 +156,32 @@ static int l_inventory_move(lua::State* L) {
return 0;
}
static int l_inventory_move_range(lua::State* L) {
auto invAid = lua::tointeger(L, 1);
auto slotAid = lua::tointeger(L, 2);
auto invA = get_inventory(invAid, 1);
validate_slotid(slotAid, invA.get());
auto invBid = lua::tointeger(L, 3);
auto slotBegin = lua::isnoneornil(L, 4) ? -1 : lua::tointeger(L, 4);
auto slotEnd = lua::isnoneornil(L, 5) ? -1 : lua::tointeger(L, 5) + 1;
auto invB = get_inventory(invBid, 3);
auto& slot = invA->getSlot(slotAid);
if (slotBegin == -1) {
invB->move(slot, content->getIndices());
} else {
invB->move(slot, content->getIndices(), slotBegin, slotEnd);
}
return 0;
}
const luaL_Reg inventorylib[] = {
{"get", lua::wrap<l_inventory_get>},
{"set", lua::wrap<l_inventory_set>},
{"size", lua::wrap<l_inventory_size>},
{"add", lua::wrap<l_inventory_add>},
{"move", lua::wrap<l_inventory_move>},
{"move_range", lua::wrap<l_inventory_move_range>},
{"get_block", lua::wrap<l_inventory_get_block>},
{"bind_block", lua::wrap<l_inventory_bind_block>},
{"unbind_block", lua::wrap<l_inventory_unbind_block>},