Ozzypig
|
  |
| Joined: 27 Mar 2008 |
| Total Posts: 4906 |
|
|
| 20 Sep 2011 05:23 PM |
I came up with five different things that anything in Lua code can be categorized in.
1) Literals Things like 5, "Hello", true, false, or tables defined by {}
2) Identifiers Names of things, like "print", "a", "Workspace", etc.
3) Operators Symbols, mostly. +, -, *, /, %, ., parenthesis, etc.
4) Keywords Language constructs for changing the flow of a program.
5) Comments Stuff that is not executed.
The thing I'm asking YOU all, is to point out some other category that I may have missed. I think everything in Lua code can be categorized in one of those 5 things though. Bonus points if you subdivide these categories.
tl;dr: What did I miss?
Why: I'm going to try writing a more effective tutorial, and see how this works out.
~Ozzy roblox.com/my/groups.aspx?gid=372 |
|
|
| Report Abuse |
|
|
| |
|
Ozzypig
|
  |
| Joined: 27 Mar 2008 |
| Total Posts: 4906 |
|
|
| 20 Sep 2011 05:27 PM |
Metatables are created with literals, of course.
Can you make a table with a metatable without defining a table literal in code?
~Ozzy roblox.com/my/groups.aspx?gid=372 |
|
|
| Report Abuse |
|
|
| |
|
|
| 20 Sep 2011 05:28 PM |
INSTANCE AS
INT = INSTANCE.NEW("HINT") x.PARENT = WORKSPACE x.TEXT = "THIS IS IN WORKSPACE TROLOLOLOLOLO" |
|
|
| Report Abuse |
|
|
Ozzypig
|
  |
| Joined: 27 Mar 2008 |
| Total Posts: 4906 |
|
|
| 20 Sep 2011 05:30 PM |
It's about the actual code symbols and stuff, not what they do.
Think of this as the nouns, verbs and adjectives of Lua.
Also...this is why we can't have nice things.
~Ozzy roblox.com/my/groups.aspx?gid=372 |
|
|
| Report Abuse |
|
|
Spectrumw
|
  |
| Joined: 04 Aug 2009 |
| Total Posts: 13510 |
|
|
| 20 Sep 2011 05:30 PM |
Operators; - Math operators; + - ^ * / %
- Logical operators; ~= == > < <= >=
Literals; - Integers; -3, -2, -1, 0, 1, 2, 3... - Floats; 1.001, 2.5, 1.337 - Booleans; true, false - Characters; 'a', 'b', 'c' - Strings; 'Hello World!'
Maybe? c: |
|
|
| Report Abuse |
|
|
Ozzypig
|
  |
| Joined: 27 Mar 2008 |
| Total Posts: 4906 |
|
|
| 20 Sep 2011 05:32 PM |
@Spectrumw I'm thinking of having that as a different list. The elements of Lua code and the types of values in Lua, you know?
~Ozzy roblox.com/my/groups.aspx?gid=372 |
|
|
| Report Abuse |
|
|
Spectrumw
|
  |
| Joined: 04 Aug 2009 |
| Total Posts: 13510 |
|
|
| 20 Sep 2011 05:33 PM |
| Wait... Were you talking about subdividing the categories you already had or... ? D: |
|
|
| Report Abuse |
|
|
xvgigakid
|
  |
| Joined: 22 Jun 2008 |
| Total Posts: 4407 |
|
|
| 20 Sep 2011 05:36 PM |
@Ozzy
"Literals" I prefer to call it, Values. |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2011 05:36 PM |
Keywords -----------
- Loops - While, repeat, for
- if then - if 1 == 1 then
- local - local variable = 'variable'
|
|
|
| Report Abuse |
|
|
Ozzypig
|
  |
| Joined: 27 Mar 2008 |
| Total Posts: 4906 |
|
|
| 20 Sep 2011 05:38 PM |
@gigakid
No, literals are values that are written in code.
a = workspace.Name
`a` has a value of string type, but there are no string literals in the code.
~Ozzy roblox.com/my/groups.aspx?gid=372 |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2011 05:41 PM |
@thisiscripters
noob y u no shorten srip
INSTANCE AS
INT = INSTANCE.NEW("HINT",workspace) INT.TEXT = "THIS IS IN WORKSPACE TROLOLOLOLOLO" |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2011 05:44 PM |
Break apart Keywords a bit, since it's a little ambiguous.
"Scope" would be better than identifiers, since identifiers are really just getfenv(0)[variable_name]. Especially since you aren't describing scope there.
You could also point out recursion / iteration, or other fundamental ideas of _computing_ on a related note. |
|
|
| Report Abuse |
|
|
pwnedu46
|
  |
| Joined: 23 May 2009 |
| Total Posts: 7534 |
|
|
| 20 Sep 2011 05:55 PM |
Would functions be considered literals too?
~ pwnedu46 ~ |
|
|
| Report Abuse |
|
|
xSIXx
|
  |
| Joined: 06 Aug 2010 |
| Total Posts: 9202 |
|
|
| 20 Sep 2011 06:08 PM |
6) innapropreate comments.
i seem to have a lot of those. |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2011 06:10 PM |
@InsertObjectScript Y U NO MAKE SKRIPT SHORTER?
h=Instance.new("Hint",workspace).Text = "umad?"
TigerBloodd | Programmer | Developer |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2011 06:50 PM |
Teh sixth element.
-The naked old man who is possibly chocolate... |
|
|
| Report Abuse |
|
|
Spectrumw
|
  |
| Joined: 04 Aug 2009 |
| Total Posts: 13510 |
|
|
| 20 Sep 2011 06:52 PM |
@Tiger What? That won't work; Instance.new("Hint",workspace).Text = "umad?"
@Noobster Are you talking about Mina Hovovich? |
|
|
| Report Abuse |
|
|
| |
|
Spectrumw
|
  |
| Joined: 04 Aug 2009 |
| Total Posts: 13510 |
|
|
| 20 Sep 2011 06:58 PM |
Whitespace; Spacebars;
Tab;
I actually included an example of each. c: |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2011 07:00 PM |
| u forgot return/enter/newline c: |
|
|
| Report Abuse |
|
|
Spectrumw
|
  |
| Joined: 04 Aug 2009 |
| Total Posts: 13510 |
|
|
| 20 Sep 2011 07:02 PM |
Enter is beetween 'Spacebar' and 'Tab' c: ucwutididther |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2011 07:03 PM |
| u didnt list it like u did th other 2 |
|
|
| Report Abuse |
|
|
Spectrumw
|
  |
| Joined: 04 Aug 2009 |
| Total Posts: 13510 |
|
|
| 20 Sep 2011 07:09 PM |
Whitespace; Spacebars; Enter;
Tab; Newline; '/n'
c: |
|
|
| Report Abuse |
|
|