FANDOM


What is Lua?Edit

Go to www.lua.org for all the info you'll ever need!

Please feel free to add your own scripts here.  Please leave an indent (one space) after starting a logic statement (if, while, for  - don't indent these parts, only whats in them, excluding else and elseif) and decreasing the indent after you close it (end) - this helps with readability. Please try to use the "Code/preformatted" font when adding code to make it easier to distinguish between code and typing, and so it doesn't take up too much space.  New programs should be under heading 2, revisions or alternateives should be under heading 3.  Please leave a blank space after each program (not revisions).

Example of properly formatted code

properformat = boolean
properformat = true
for x = 1,5 do
 print("This is properly formatted code")
 if properformat == true then
  print("Using proper format!")
 else
  print("We're not using proper format, we should fix that!")
  properformat = true
 end

Door LockEdit

write("Enter Password")
input = read()
password = "Open Door"
if input == password then
 print("Access Granted")
 rs.setOutput("back", true)
 sleep(1)
 rs.setOutput("back", false)
else
 print("Access Denied")
 sleep(1)
 os.reboot()
end

Monitor Text ProgramEdit

mon = peripheral.wrap("back")
mon.clear()
mon.setTextScale(1)
mon.setCursonPos(1, 1)
mon.write("Help me i'm trapped in here") 

Computer LockEdit

To be added.

​Bomb Defusal ProgramEdit

write("Which wire do you cut? The Red Wire or The Blue Wire?")
side = "bottom" 
input = read()
password = "The Red Wire"
if input == password then
 print("Bomb Defused")
else
 print("Detonating Bomb")
 rs.setOutput(side, true)
end

You will need to have a redstone signal going through the side you put in the variable side for this program to do something when you don't enter "The Red Wire" for input. You will also need TNT on the selected side for the explosion to happen obviously.

Single Shot LauncherEdit

write("Enter Password")
input = read()
password = "Fire"
if input == password then
 print("Access Granted")
 rs.setOutput("back", true)
 sleep(1)
 rs.setOutput("back", false)
else
 print("Access Denied")
 sleep(1)
 os.reboot()
end


Welcome ProgramEdit

​print("Welcome")

Write to fileEdit

inp = string
print("What would you like to write?")
write(">Write>")
file = fs.open("File", a)
file.writeLine(read())
file.close()

9-Shot Rapid FireEdit

while true do
 print("Enter Password")
 password = "Fire"
 if read() == password then
  print("Access Granted")
  for x = 1,10 do
   rs.setOutput("back", true)
   sleep(.1)
   rs.setOutput("back", false)
  end
 else
  print("Access Denied")
  sleep(1)
 end

Welcome ProgramEdit

x = string  --x is the location
x = "your home!"
print("Welcome to " .. x)

Door LockEdit

while true do
 write("Enter Password")
 password = "Open Door"
 if read() == password then
  print("Access Granted")
  rs.setOutput("back", true)
  sleep(1)
  rs.setOutput("back", false)
 else
  print("Access Denied")
  sleep(1)
 end

PLEASE DO NOT OVERWRITE OR EDIT OTHER PEOPLE'S CODES.  IF YOU WOULD LIKE TO MAKE CHANGES TO SOMEONE ELSE'S CODE THEN ADD IT AS A REVISION AND IF IT IS BETTER IT WILL BE CHOSEN AS THE OFFICIAL VERSION.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.