sWaffle7982

calcCoal

Aug 5th, 2021 (edited)
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.44 KB | None | 0 0
  1. --[[===================
  2.  
  3. Made by: Nemo Eriksson
  4. Pastebin: y0REd03h
  5.  
  6. ====================]]--
  7.  
  8. -- Returns the coal needed to dig the specified area
  9. function calcCoalNeeded(xSize, ySize, zSize)
  10.   local totalVolume = xSize * ySize * zSize
  11.   local coalNeeded = math.ceil(totalVolume/80)
  12.   return coalNeeded
  13. end
  14.  
  15. -- Get user input and print how much coal needed
  16. local args = {...}
  17. print(calcCoalNeeded(args[1], args[2], args[3]))  -- X Y Z
  18.  
Advertisement
Add Comment
Please, Sign In to add comment