ULX

Author Topic: Learning Lua... (Just a random post from a lua super noob.)  (Read 14578 times)

0 Members and 2 Guests are viewing this topic.

Offline syn.

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 6
  • Lua Padawan
    • SynGaming
Learning Lua... (Just a random post from a lua super noob.)
« on: January 24, 2014, 08:53:36 AM »
Code: [Select]
x = "Kenny"
if x == "Brandon" then
print("Hi, " .. x)
end
if x ~= "Brandon" then
print ("You are not Brandon, " .. x)
end

Code: [Select]
You are not Brandon, KennyI swear I started crying when this actually worked!
God I feel like I accomplished something this week:)
Lua Student

"The more you understand, the crazier you get."

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Learning Lua... (Just a random post from a lua super noob.)
« Reply #1 on: January 24, 2014, 09:02:47 AM »
While I understand you're a "Lua super noob", this would work as well, in the same way.
Code: [Select]
x = "Kenny"
if x == "Brandon" then
print("Hi, " .. x)
else
print ("You are not Brandon, " .. x)
end
It does the same exact thing as your code, but basically it does "Is 'X' Brandon? No. I'll print the 'else' code".

Other than that, you're doing good. I remember doing something that was similar in my earlier Lua days.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Learning Lua... (Just a random post from a lua super noob.)
« Reply #2 on: January 24, 2014, 10:24:22 AM »
I used to do things like this in BASIC back in.... 1998. You're doing it right. Learn the basics. Learn how coding works. You'll pick up more advanced stuff in time.

Too many people just try to jump right in and start editing. Then they don't know what they're doing, only how to modify certain things.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Learning Lua... (Just a random post from a lua super noob.)
« Reply #3 on: January 24, 2014, 03:35:29 PM »
I echo Decicus and MrP. We see so many people come through these forums asking us to teach them to do xyz task, by which they normally mean "do it for me". Good to see you're not getting frustrated by what may seem like small accomplishments.
Experiencing God's grace one day at a time.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Learning Lua... (Just a random post from a lua super noob.)
« Reply #4 on: January 24, 2014, 09:01:48 PM »
Learning one language will make learning other languages easier.

Lua is a good place to start.
Out of the Garry's Mod business.

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given