Advertisement
pson

floor.lua

Aug 27th, 2022 (edited)
1,000
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.18 KB | Gaming | 0 0
  1. -- MIT License
  2.  
  3. -- Copyright (c) 2023 Dan Pettersson
  4.  
  5. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  6. -- of this software and associated documentation files (the "Software"), to deal
  7. -- in the Software without restriction, including without limitation the rights
  8. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. -- copies of the Software, and to permit persons to whom the Software is
  10. -- furnished to do so, subject to the following conditions:
  11.  
  12. -- The above copyright notice and this permission notice shall be included in all
  13. -- copies or substantial portions of the Software.
  14.  
  15. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  21. -- SOFTWARE.
  22. -- ================================================================================
  23. -- A program that will build a floor either above or below the current position
  24.  
  25. function usage()
  26.     print "Arguments: <LR|LL> <Height offset> <Length> <Width>"
  27.     print "All arguments are given relative to the turtles"
  28.     print "current position and rotation."
  29.     print ""
  30.     print "If you want to make a floor bigger than 50x50, do it in stages."
  31.     print ""
  32.     print "Slot 1) Fuel to be used by the turtle as it moves around."
  33.     print ""
  34.     print "Slot 2) The material the floor should be made of. The program will try"
  35.     print "and refill this slot from the others as necceary."
  36.     os.exit()
  37. end
  38.  
  39. function test()
  40.     print arg
  41. end
  42.  
  43. function arguments()
  44.     if #arg ~= 4 then usage() end
  45.     LRLL = arg[1]
  46.     if LRLL ~= "LR" and LRLL ~= "LL" then
  47.         usage()
  48.     end
  49.     offset = tonum(arg[2])
  50.     length = tonum(arg[3])
  51.     width = tonum(arg[4])
  52.  
  53.     if length < 1 or length > 50 or width < 1 or width > 50 then
  54.         usage()
  55.     end
  56. end
  57. print arg
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement