Advertisement
birdini

Command Translation

May 18th, 2019
648
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.65 KB | None | 0 0
  1. function attempt(func,args)
  2.     return func(args)
  3. end
  4.  
  5. function translate(input)
  6.     local c = {} --commands lookup table, in lieu of a switch statement
  7.     c["forward"] = turtle.forward
  8.     c["up"] = turtle.up
  9.     c["down"] = turtle.down
  10.     c["back"] = turtle.back
  11.     c["turnRight"] = turtle.turnRight
  12.     c["turnLeft"] = turtle.turnLeft
  13.    
  14.     c["select"] = turtle.select
  15.     c["getSelectedSlot"] = turtle.getSelectedSlot
  16.     c["getItemCount"] = turtle.getItemCount
  17.     c["getItemSpace"] = turtle.getItemSpace
  18.     c["getItemDetail"] = turtle.getItemDetail
  19.    
  20.     c["equipLeft"] = turtle.equipLeft
  21.     c["equipRight"] = turtle.equipRight
  22.    
  23.     c["attack"] = turtle.attack
  24.     c["attackUp"] = turtle.attackUp
  25.     c["attackDown"] = turtle.attackDown
  26.    
  27.     c["dig"] = turtle.dig
  28.     c["digUp"] = turtle.digUp
  29.     c["digDown"] = turtle.digDown
  30.    
  31.     c["place"] = turtle.place
  32.     c["placeUp"] = turtle.placeUp
  33.     c["placeDown"] = turtle.placeDown
  34.    
  35.     c["detect"] = turtle.detect
  36.     c["detectDown"] = turtle.detectDown
  37.     c["detectUp"] = turtle.detectup
  38.    
  39.     c["inspect"] = turtle.inspect
  40.     c["inspectUp"] = turtle.inspectUp
  41.     c["inspectDown"] = turtle.inspectDown
  42.    
  43.     c["compare"] = turtle.compare
  44.     c["compareUp"] = turtle.compareUp
  45.     c["compareDown"] = turtle.compareDown
  46.     c["compareTo"] = turtle.compareTo
  47.    
  48.     c["drop"] = turtle.drop
  49.     c["dropUp"] = turtle.dropUp
  50.     c["dropDown"] = turtle.dropDown
  51.    
  52.     c["suck"] = turtle.suck
  53.     c["suckUp"] = turtle.suckUp
  54.     c["suckDown"] = turtle.suckDown
  55.    
  56.     c["refuel"] = turtle.refuel
  57.     c["getFuelLevel"] = turtle.getFuelLevel
  58.     c["getFuelLimit"] = turtle.getFuelLimit
  59.    
  60.     c["transferTo"] = turtle.transferTo
  61.    
  62.     if c[input] == nil then
  63.         return false
  64.     end
  65.    
  66.     return c[input]
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement