
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.
17 lines
375 B
Text
17 lines
375 B
Text
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
|