performance change
This commit is contained in:
+2
-2
@@ -79,7 +79,7 @@ end
|
|||||||
function M.merchant_info(item_id)
|
function M.merchant_info(item_id)
|
||||||
local buy_info
|
local buy_info
|
||||||
if aux_merchant_buy[item_id] then
|
if aux_merchant_buy[item_id] then
|
||||||
buy_info = temp-persistence.read(merchant_buy_schema, aux_merchant_buy[item_id])
|
buy_info = persistence.read(merchant_buy_schema, aux_merchant_buy[item_id])
|
||||||
end
|
end
|
||||||
return aux_merchant_sell[item_id], buy_info and buy_info.unit_price, buy_info and buy_info.limited
|
return aux_merchant_sell[item_id], buy_info and buy_info.unit_price, buy_info and buy_info.limited
|
||||||
end
|
end
|
||||||
@@ -87,7 +87,7 @@ end
|
|||||||
function M.item_info(item_id)
|
function M.item_info(item_id)
|
||||||
local data_string = aux_items[item_id]
|
local data_string = aux_items[item_id]
|
||||||
if data_string then
|
if data_string then
|
||||||
local cached_data = temp-persistence.read(items_schema, data_string)
|
local cached_data = persistence.read(items_schema, data_string)
|
||||||
return O(
|
return O(
|
||||||
'name', cached_data.name,
|
'name', cached_data.name,
|
||||||
'itemstring', 'item:' .. item_id .. ':0:0:0',
|
'itemstring', 'item:' .. item_id .. ':0:0:0',
|
||||||
|
|||||||
+2
-2
@@ -34,11 +34,11 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
function get_new_record()
|
function get_new_record()
|
||||||
return O('next_push', next_push, 'data_points', T)
|
return temp-O('next_push', next_push, 'data_points', T)
|
||||||
end
|
end
|
||||||
|
|
||||||
function read_record(item_key)
|
function read_record(item_key)
|
||||||
local record = temp-(data[item_key] and persistence.read(history_schema, data[item_key]) or new_record)
|
local record = data[item_key] and persistence.read(history_schema, data[item_key]) or new_record
|
||||||
if record.next_push <= time() then
|
if record.next_push <= time() then
|
||||||
push_record(record)
|
push_record(record)
|
||||||
write_record(item_key, record)
|
write_record(item_key, record)
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ function M.read(schema, str)
|
|||||||
elseif schema == 'number' then
|
elseif schema == 'number' then
|
||||||
return tonumber(str)
|
return tonumber(str)
|
||||||
elseif type(schema) == 'table' and schema[1] == 'list' then
|
elseif type(schema) == 'table' and schema[1] == 'list' then
|
||||||
return read_list(schema, str)
|
return temp-read_list(schema, str)
|
||||||
elseif type(schema) == 'table' and schema[1] == 'tuple' then
|
elseif type(schema) == 'table' and schema[1] == 'tuple' then
|
||||||
return read_tuple(schema, str)
|
return temp-read_tuple(schema, str)
|
||||||
else
|
else
|
||||||
error('Invalid schema.', 2)
|
error('Invalid schema.', 2)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user