diff options
author | jingkaimori <jingkaimori@gmail.com> | 2021-11-10 20:40:33 +0800 |
---|---|---|
committer | jingkaimori <jingkaimori@gmail.com> | 2021-11-10 20:40:33 +0800 |
commit | 6539850c0562eab3ecc8ab7a4079c9c22f58122b (patch) | |
tree | ae405f9a94eddaab5a8f3321bb7550c7a54ec01e /doc | |
parent | 573c992ba46269c7c04ca0b0e7d094f9e8804096 (diff) | |
download | smartshop-6539850c0562eab3ecc8ab7a4079c9c22f58122b.tar.gz smartshop-6539850c0562eab3ecc8ab7a4079c9c22f58122b.tar.bz2 smartshop-6539850c0562eab3ecc8ab7a4079c9c22f58122b.zip |
document and clean-up
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api.md | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/doc/api.md b/doc/api.md new file mode 100644 index 0000000..012d882 --- /dev/null +++ b/doc/api.md @@ -0,0 +1,99 @@ +# Digiline interface + +## get shop status + + + +```lua +digiline_send('channel', { + type='get' + } +) +``` + +response from shop looks like this: + +```lua +{ + offer = { + { + give_count = 4, + pay_count = 3, + pay = "basenodes:cobble", + stock = 0, + give = "basenodes:dirt", + pay_price = 0 + }, + { + give_count = 25, + pay_count = 1, + pay = "currency:minegeld_10", + stock = 1, + give = "digilines:lcd", + pay_price = 0.4 + }, + { + give_count = 12, + pay_count = 3, + pay = "currency:minegeld_10", + stock = 4, + give = "digilines:lcd", + pay_price = 2.5 + }, + { + give_count = 9, + pay_count = 3, + pay = "currency:minegeld_10", + stock = 5, + give = "digilines:lcd", + pay_price = 3.3333333333333 + } + }, + inventory = { + { + meta = { + + }, + metadata = "", + count = 25, + name = "digilines:lcd", + wear = 0 + }, + [5] = { + meta = { + + }, + metadata = "", + count = 3, + name = "currency:minegeld_10", + wear = 0 + }, + [28] = { + meta = { + palette_index = "0" + }, + metadata = "", + count = 1, + name = "testnodes:mesh_colorwallmounted", + wear = 0 + } + } +} +``` + + + +## set shop offer + +following program will set third slot of offer, then this slot will receive three cobble for four dirt + +```lua +digiline_send('channel', { + type='set', + offer={ + [3] = {give="basenodes:dirt",give_count=4,pay="basenodes:cobble",pay_count=3} + } + } +) +``` + |