Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ~~~~@ Intro @~~~~
- First of all, Im Rickydaan, a Very good CC Lua scripter. Im here to learn you guys the steps about CC Lua, So u guys become the same good as me!
- Today we will learn:
- "Basic steps"
- "Shell and Os functions"
- "Variables"
- "Using the read() function"
- "If / Elseif / Else / End " function
- So we know we will be learning "CC Lua" Some things WONT work in real Lua. Each Lua program got unique functions!
- ~~~~@ Basic Steps @~~~~
- First of all Lets make a terminal.
- There are some basic intregated programs. We will use: "lua" to toy arround
- Type lua
- Then lets "print" something on the screen.
- Type:
- print("Hello World")
- once u opened the lua file.
- Amazing isnt it?
- I will be using words as: "Strings" "Brackets" "Booleans"
- Strings = ""
- Brackets = {}
- Booleans = ()
- ~~~~@ Shell and Os functions @~~~~
- There are different functions:
- WARNING: CaseSensitive
- shell.run("PROGRAMNAME") -- Runs another program from program running
- shell.getRunningProgram() -- Gets the name of the program running
- shell.exit() -- Exits the program
- shell.programs() -- Lists all programs
- -- Find more typing: help shellapi --
- OS:
- os.shutdown() -- Clears screen and you wont be able to do ANYTHING
- os.version() -- Gets the version of CC?
- os.reboot() -- Shutdowns and starts PC
- os.sleep( TIME !! NO STRINGS !! ) -- Let the PC "Freeze" for xxx seconds
- os.setComputerLabel( LABEL ) -- Sets a computer label
- os.getComputerLabel() -- Gets the computer label
- -- Find more typing help os --
- Term:
- term.clear() -- Clears the screen
- term.setCursorPos(x,y) -- Sets the cursor pos to xxx yyy
- term.getCursorPos() -- Gets the cursor pos (2 Variables required)
- -- Find more help typing help term --
- ~~~~@ Variables @~~~~
- A Variable (var) is also used to "Store" a "Strings content" or a "number's content "
- Here is a small script using a variable:
- @@
- a = "Lol"
- print(a)
- @@
- It will print a, A variable is called WITHOUT strings.
- ~~~~@ Using the Read() function @~~~~
- This will be a further explination of the Variables.
- A read() function reads a input -- So it will let you type!
- Heres a example of printing a read() value:
- @@
- term.clear()
- term.setCursorPos(1,1)
- print("Input something!")
- input = read()
- print("Lemme think...")
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- print("You printed " .. input .. "!")
- @@
- The dots is to say like: Strings .. Variable!!!
- Heres a expample of hiding it (the read() becomes read("X")
- @@
- term.clear()
- term.setCursorPos(1,1)
- print("Input something!")
- input = read("X")
- print("Lemme think...")
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- print("You printed " .. input .. "!")
- @@
- ~~~~@ If, Elseif. Else, End@~~~~
- A IF always needs to be CLOSED with a end. Lets do a password!
- @@
- term.clear()
- term.setCursorPos(1,1)
- print("PASSWORD PLEASE")
- a = read("X")
- if a == "password" then
- print("GOOD")
- else
- print("BAD")
- end
- @@
- See? if a (VARIABLE) == "password" (password is the password) then (Then xxx happens)
- The Then needs also to be done at elseif
- See y'a next time!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement