1
Fork 0
This repository has been archived on 2025-04-09. You can view files and clone it, but cannot push or open issues or pull requests.
computer-craft/lib/utils
unknown f530d034ad added lib folder with some handy modules
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.
2012-04-30 15:02:19 +02:00

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