| |
|
Seranok
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 11083 |
|
|
| 30 Jul 2012 01:37 PM |
Because you get unreadable code like this:
script.Parent.Touched:connect( function(part) if part.ClassName == "Part" then local bodyPartNames = { "Torso", "Head", "Right Arm", "Left Arm", "Right Leg", "Left Leg", } for _, bodyPartName in pairs(bodyPartNames) do if bodyPartName == part.Name then local parent = part.Parent if parent and parent.ClassName == "Model" then local humanoid = parent:FindFirstChild("Humanoid") if humanoid and humanoid.ClassName == "Humanoid" then local player = game.Players:GetPlayerFromCharacter(parent) if player then player:Destroy() end end end else return end end end end) |
|
|
| Report Abuse |
|
|
Seranok
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 11083 |
|
|
| 30 Jul 2012 01:39 PM |
| I wonder what end-stacking is... |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2012 01:43 PM |
| Surely it is easier to put only call the BodyParts array once? |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2012 01:46 PM |
@Sera
if this then if that then if finally then end end end |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2012 01:47 PM |
Also @Sera
You don't need all that code. :o
part.Touched:connect(function(part) local player = game:GetService("Players"):GetPlayerFromCharacter(part.Parent) if not player then return end print(player.Name) end) |
|
|
| Report Abuse |
|
|
8SunTzu8
|
  |
| Joined: 30 Sep 2011 |
| Total Posts: 8199 |
|
|
| 30 Jul 2012 04:25 PM |
Idk, I just put all of my ends on the same line unless I need to do otherwise.
function Hi() if Active and a then x + 1 = b print (b) elseif Active and c then if b < 0 then print (b) end end end
Totally worthless code that serves no purpose, and looks like it could be more efficient. Just an example if what I do with ends. But I give them a separate line, even when they are separated. I don't like indenting unless I need to.
"Improvise, Overcome, and Adapt." -Captain (RIP) |
|
|
| Report Abuse |
|
|
xSIXx
|
  |
| Joined: 06 Aug 2010 |
| Total Posts: 9202 |
|
|
| 30 Jul 2012 04:30 PM |
"and looks like it could be more efficient"
get out. |
|
|
| Report Abuse |
|
|
8SunTzu8
|
  |
| Joined: 30 Sep 2011 |
| Total Posts: 8199 |
|
|
| 30 Jul 2012 04:32 PM |
kk whatever you say king of the scripters forum
"Improvise, Overcome, and Adapt." -Captain (RIP) |
|
|
| Report Abuse |
|
|
TheMyrco
|
  |
| Joined: 13 Aug 2011 |
| Total Posts: 15105 |
|
|
| 30 Jul 2012 04:32 PM |
| First of all not stacking makes.it look cooler to my opinion and you'll be able to see if you did or did not end a scope. |
|
|
| Report Abuse |
|
|
xSIXx
|
  |
| Joined: 06 Aug 2010 |
| Total Posts: 9202 |
|
|
| 30 Jul 2012 04:34 PM |
kk whatever you say offical "person trying to act smart" of the scripters forum.
seriously, this guy has been doing it for like two months now. |
|
|
| Report Abuse |
|
|
aboy5643
|
  |
| Joined: 08 Oct 2010 |
| Total Posts: 5458 |
|
|
| 30 Jul 2012 04:35 PM |
@8sun
I kinda agree with x6x. It should really be pretty obvious that stacking end's does absolutely nothing but screw readability. As well, I'd gander that reading returns is easier than reading a space because a return in Lua is very definite as something new while space holds some abiguity. Besides the point, there is likely NO difference at all. |
|
|
| Report Abuse |
|
|
TheMyrco
|
  |
| Joined: 13 Aug 2011 |
| Total Posts: 15105 |
|
| |
|
8SunTzu8
|
  |
| Joined: 30 Sep 2011 |
| Total Posts: 8199 |
|
|
| 30 Jul 2012 04:36 PM |
I'm not trying to act smart.
I'm here to learn.
Anyway...
I sometimes don't stack the ends and add indentation when I need to get a clearer picture of the scopes, but otherwise, I don't.
A couple algorithms I did it a little bit on, but I try avoiding it.
"Improvise, Overcome, and Adapt." -Captain (RIP) |
|
|
| Report Abuse |
|
|
aboy5643
|
  |
| Joined: 08 Oct 2010 |
| Total Posts: 5458 |
|
|
| 30 Jul 2012 04:37 PM |
| "I'm here to learn." Unless you're learning how to play with CFrame matrices or something, learning shouldn't happen in this sub forum. |
|
|
| Report Abuse |
|
|
8SunTzu8
|
  |
| Joined: 30 Sep 2011 |
| Total Posts: 8199 |
|
|
| 30 Jul 2012 04:40 PM |
By learning, I meant I am here to improve my skills and knowledge with Lua and of the ROBLOX engine.
A lot of the threads here have useful information, and I like to use it to become a better scripter myself.
I don't think that end stacking or how you indent things affects performance at all. When I said the function could have been made more efficient, I was thinking of ways it could be shortened.
Anyway... I'm the type of person who does research on various topics before I apply any knowledge in those subjects/fields/topics.
"Improvise, Overcome, and Adapt." -Captain (RIP) |
|
|
| Report Abuse |
|
|
8SunTzu8
|
  |
| Joined: 30 Sep 2011 |
| Total Posts: 8199 |
|
|
| 30 Jul 2012 04:41 PM |
I'm currently trying to figure out welds, JSON encoding and decoding, and I believe CFrame matrices hits it spot on. (But that's mostly for getting tool meshes to orientate the correct way).
"Improvise, Overcome, and Adapt." -Captain (RIP) |
|
|
| Report Abuse |
|
|
TheMyrco
|
  |
| Joined: 13 Aug 2011 |
| Total Posts: 15105 |
|
| |
|
8SunTzu8
|
  |
| Joined: 30 Sep 2011 |
| Total Posts: 8199 |
|
|
| 30 Jul 2012 04:49 PM |
Yeah.
I didn't know about JSON until a friend pointed it out. I was thinking that I could put a bunch of values into a string value object, and then store them into 1 object, vs 10-20 objects. JSON seems to be what I need.
It also makes me think about the possibility of taking save data from one game to another for an RPG. (Or ROBLOX could just let us know what's going on with universes). :/
"Improvise, Overcome, and Adapt." -Captain (RIP) |
|
|
| Report Abuse |
|
|
TheMyrco
|
  |
| Joined: 13 Aug 2011 |
| Total Posts: 15105 |
|
|
| 30 Jul 2012 04:51 PM |
O.o Ehhh...veel succes! (goodluck) |
|
|
| Report Abuse |
|
|
8SunTzu8
|
  |
| Joined: 30 Sep 2011 |
| Total Posts: 8199 |
|
|
| 30 Jul 2012 04:52 PM |
Sie sollten Deutsch sprechen. Deutsch ist eine tolle Sprache.
"Improvise, Overcome, and Adapt." -Captain (RIP) |
|
|
| Report Abuse |
|
|
TheMyrco
|
  |
| Joined: 13 Aug 2011 |
| Total Posts: 15105 |
|
|
| 30 Jul 2012 04:55 PM |
| Richtig. Ich bin jetzt in Österreich mit Urlaub. |
|
|
| Report Abuse |
|
|
xSIXx
|
  |
| Joined: 06 Aug 2010 |
| Total Posts: 9202 |
|
|
| 30 Jul 2012 04:55 PM |
"i am hear to learn"
or you are hear just to gain reputation or to call your self a "Member Of the Scripters" just to show off you your piddly little warclanmates?
that has to be the stupidest excuse i have ever heard. if you want to learn how to script, then you should not start by reading posts made by people who have been doing this stuff for a couple of years.
start basic. you obviously can't do basic judging by your posts. |
|
|
| Report Abuse |
|
|
8SunTzu8
|
  |
| Joined: 30 Sep 2011 |
| Total Posts: 8199 |
|
|
| 30 Jul 2012 05:00 PM |
I'd consider myself intermediate.
The wiki is a useful tool as well. But, I can't get the information I want to make my scripting better or more efficient by reading specific parts of the wiki. It's like geometry, everyone has their own ways of solving problems.
If I expose myself to a lot of experienced users of Lua, and other languages as well, I can see things differently, and further my own abilities.
I don't care what sort of speculations you're going to make, but I'm an honest person. I don't "show off" to anyone. Heck, half the time I offer my help whenever possible. If I can do something for someone else who is unable to, then why not?
I'm not a typical C&Ger. You can group me with the rest if you want, but that's your decision.
"Improvise, Overcome, and Adapt." -Captain (RIP) |
|
|
| Report Abuse |
|
|
xSIXx
|
  |
| Joined: 06 Aug 2010 |
| Total Posts: 9202 |
|
|
| 30 Jul 2012 05:02 PM |
"The wiki is a useful tool as well. But, I can't get the information I want to make my scripting better or more efficient by reading specific parts of the wiki. It's like geometry, everyone has their own ways of solving problems. "
you're doing the trying to act smart thing again.
adding extra fluff to your post does not make you sound smart.
"I'd consider myself intermediate. "
1. then why do you make "terrible scripter" level posts. 2. then why are you here in the advanced section. stick to c&g.
"If I expose myself to a lot of experienced users of Lua, and other languages as well, I can see things differently, and further my own abilities."
... how?
"I don't care what sort of speculations you're going to make, but I'm an honest person. I don't "show off" to anyone. Heck, half the time I offer my help whenever possible. If I can do something for someone else who is unable to, then why not?"
get out.
|
|
|
| Report Abuse |
|
|