-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3462f17
commit a3bede8
Showing
6 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
project='blockexchange' | ||
title='Blockexchange minetest mod' | ||
description='cloud schematic exchanger' | ||
backtick_references=false | ||
file='.' | ||
dir='../out' | ||
dir='docs' | ||
examples={'examples'} | ||
format = 'markdown' | ||
readme = {'readme.md'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
-- luacheck: no unused | ||
|
||
local pos1 = { x=1, y=0, z=0 } | ||
local data = blockexchange.get_area(pos1) | ||
|
||
-- upload example data | ||
data = { | ||
pos1 = { x=0, y=0, z=0 }, | ||
pos2 = { x=2, y=0, z=0 }, | ||
data = { | ||
type = "upload", | ||
schemaid = 99, | ||
schemaname = "my_schema", | ||
username = "MyAccount", | ||
owner = "singleplayer", | ||
origin = { x=0, y=0, z=0 } | ||
} | ||
} | ||
|
||
-- download example data | ||
data = { | ||
pos1 = { x=0, y=0, z=0 }, | ||
pos2 = { x=2, y=0, z=0 }, | ||
data = { | ||
type = "download", | ||
schemaid = 99, | ||
schemaname = "my_schema", | ||
username = "MyAccount", | ||
owner = "singleplayer", | ||
origin = { x=0, y=0, z=0 } | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-- luacheck: no unused | ||
-- Source: https://github.com/Billiam/promise.lua | ||
|
||
-- create a new promise | ||
local promise = Promise.new() | ||
|
||
-- register callbacks | ||
promise:next(function(value) | ||
-- value == 2 | ||
end):catch(function(err) | ||
print("something went wrong: " .. err) | ||
end) | ||
|
||
-- resolve promise somewhere in an async code | ||
promise:resolve(2) | ||
|
||
-- example with the blockexchange info endpoint | ||
blockexchange.api.get_info():next(function(info) | ||
info = { | ||
api_version_major = 1, | ||
api_version_minor = 1, | ||
owner = "someone", | ||
name = "central exchange" | ||
} | ||
end):catch(function(err) | ||
print("something went wrong: " .. err) | ||
end) |