This commit is contained in:
Kae 2023-10-31 06:00:11 +11:00
commit ad8c17e338

View File

@ -12,17 +12,17 @@ LuaValue LuaConverter<InventorySlot>::from(LuaEngine& engine, InventorySlot k) {
return table; return table;
} }
else if (k.is<SwapSlot>()) else if (k.is<SwapSlot>())
return engine.createString("Swap"); return engine.createString("swap");
else if (k.is<TrashSlot>()) else if (k.is<TrashSlot>())
return engine.createString("Trash"); return engine.createString("trash");
} }
Maybe<InventorySlot> LuaConverter<InventorySlot>::to(LuaEngine&, LuaValue const& v) { Maybe<InventorySlot> LuaConverter<InventorySlot>::to(LuaEngine&, LuaValue const& v) {
if (auto str = v.ptr<LuaString>()) { if (auto str = v.ptr<LuaString>()) {
auto string = str->toString(); auto string = str->toString();
if (string.equalsIgnoreCase("Swap")) if (string.equalsIgnoreCase("swap"))
return SwapSlot(); return SwapSlot();
else if (string.equalsIgnoreCase("Trash")) else if (string.equalsIgnoreCase("trash"))
return TrashSlot(); return TrashSlot();
else if (auto equipment = EquipmentSlotNames.leftPtr(str->toString())) else if (auto equipment = EquipmentSlotNames.leftPtr(str->toString()))
return *equipment; return *equipment;