forked from minetest-mods/global_exchange
Improve market summary displaying long item names
This commit is contained in:
parent
9c8f62320e
commit
6989f6a00e
@ -14,8 +14,8 @@ local function split(str, sep)
|
|||||||
local regex = ("([^%s]+)"):format(sep)
|
local regex = ("([^%s]+)"):format(sep)
|
||||||
for each in str:gmatch(regex) do
|
for each in str:gmatch(regex) do
|
||||||
local sub = nil
|
local sub = nil
|
||||||
if #each > 25 then
|
if #each > 34 then
|
||||||
sub = string.sub(each, 1, 25).."..."
|
sub = string.sub(each, 1, 34).."..."
|
||||||
end
|
end
|
||||||
table.insert(result, sub or each)
|
table.insert(result, sub or each)
|
||||||
end
|
end
|
||||||
@ -51,8 +51,8 @@ local function mk_summary_fs()
|
|||||||
local all_items = minetest.registered_items
|
local all_items = minetest.registered_items
|
||||||
for i, row in ipairs(exchange:market_summary()) do
|
for i, row in ipairs(exchange:market_summary()) do
|
||||||
local def = all_items[row.Item] or {}
|
local def = all_items[row.Item] or {}
|
||||||
add_row(row.Item,
|
add_row(#row.Item > 24 and string.sub(row.Item, 1, 24).."..." or row.Item,
|
||||||
split(def.description, "\n")[1] or S("Unknown Item"),
|
split(def.description, "\n")[1] or S("No description"),
|
||||||
wear_string(row.Wear),
|
wear_string(row.Wear),
|
||||||
row.Buy_Volume or 0,
|
row.Buy_Volume or 0,
|
||||||
row.Buy_Max or "N/A",
|
row.Buy_Max or "N/A",
|
||||||
|
@ -53,6 +53,7 @@ Buy Max=Achat Max
|
|||||||
Sell Vol=Qté vente
|
Sell Vol=Qté vente
|
||||||
Sell Min=Vente Min
|
Sell Min=Vente Min
|
||||||
Unknown Item=Item inconnue
|
Unknown Item=Item inconnue
|
||||||
|
No description=Pas de description
|
||||||
New (-0%)=Neuf (-0%)
|
New (-0%)=Neuf (-0%)
|
||||||
Good (-10%)=Bon (-10%)
|
Good (-10%)=Bon (-10%)
|
||||||
Worn (-50%)=Usé (-50%)
|
Worn (-50%)=Usé (-50%)
|
||||||
|
Loading…
Reference in New Issue
Block a user