Browse Source
utils a library for some handy library functions now constains ask confirmation which takes a pre and post condition and asks you if you want to continue. Also a turtle module which allows you to test your code for syntax errors.master
unknown
13 years ago
3 changed files with 52 additions and 19 deletions
@ -0,0 +1,18 @@ |
|||
local function placeholder() return true end |
|||
|
|||
local turtle = {} |
|||
|
|||
turtle.up = placeholder |
|||
turtle.down = placeholder |
|||
turtle.digUp = placeholder |
|||
turtle.digDown = placeholder |
|||
turtle.dig = placeholder |
|||
turtle.forward = placeholder |
|||
turtle.turnLeft = placeholder |
|||
turtle.turnRight = placeholder |
|||
turtle.detect = placeholder |
|||
turtle.getItemCount = placeholder |
|||
turtle.placeDown = placeholder |
|||
turtle.select = placeholder |
|||
|
|||
return turtle |
@ -0,0 +1,17 @@ |
|||
local function confirmExe(pre, post) |
|||
print("Pre:", pre) |
|||
print("Post:", post) |
|||
print("Do you want to continue Y/N [Y]: ") |
|||
local confirmation = io.stdin:read(1) |
|||
if (confirmation == 'n' or confirmation == 'N') then |
|||
print("Aborted") |
|||
return false |
|||
end |
|||
io.stdin:read("*a") -- clear stdin |
|||
end |
|||
|
|||
local utils = {} |
|||
|
|||
utils.confirmExecution = confirmExe |
|||
|
|||
return utils |
Reference in new issue