--comment-- --[[ multi-lined comment ]]-- --[[ Data types: Nil: Absence of data. Does NOT mean 0 or false Boolean: True or false Number: Integers(0, 1, 2, 3, etc.) and Floats(1.5, 2.23, -0.8, 3.14 etc.) String: string of characters. Example: "I ate 3 salmon burgers." Function Userdata Thread Table ]]-- --print, must be lower case p-- print("Go away") --define local variables. Must not start with a number. Can contain letters, numbers. Are case sensitive. -- -- and underscores-- local reply = "No!" local number = 10 --print local variables-- print(reply) print(number) --define function-- local function Hello () print ("Hello Stupid!") end --to run function-- Hello () -- example diameter = 10 function DiameterToCircumference () circumference = diameter * 3.14 print(circumference) end DiameterToCircumference () diameter = 20 DiameterToCircumference () --Maths-- --Method one-- local a = 3 local b = 4 local answer = a + b local answer2 = a * b local answer3 = a / b local answer4 = a ^ b local answer5 = b % a print(answer) print(answer2) print(answer3) print(answer4) print(answer5) --Method Two-- print(3+4) print(3*4) print(3/4) print(3^4) --Method Three-- print(a + b) print(a * b) print(a / b) print(a ^ b) print(b % a) -- Example Salary = 1000 Food = 200 rent = 400 investment = 150 Result = Salary - (Food + rent + investment) print (Result) --Text Input-- print("What is your name? \n") --reads text input local name = io.read(); --.. adds on a string print("Hi "..name.. "!") --still confused on this-- --need to watch more tutorials on this-- --if else-- -- == means equality -- -- < means less than -- -- > means greater than -- -- <= means less than or equal to -- -- >= means greater than or equal to -- -- ~= means inequality -- local x = 1 local y = 2 if x == y then print ("equal") else print ("Not equal") end Health = 0 if Health <= 0 than print("Game Over") end range = 50 if range > 0 and range < 101 then print ("inbetween 0 and 101") end money = 50 if money > 100 and money < 200 then print (money) elseif money <= 100 then print ("I am poor.") else print ("I am rich.") end -- Tables TableName = {} TableName.VariableName = 10 --variable in a table TableName.TableName2 --table in a table --Alternate way: TableName3 = {VariableName2 = 20, TableName4 = {} } --LOVE functions --load data for game function love.load() end --frame by frame update. dt means delta time, which is frame independent time. function love.update(dt) end -- drawing graphics function love.draw() end