|
| 21 Sep 2012 04:50 PM |
i = Instance.new
Now, if you have a script that does a lot of instancing then you could use that, to me that's much easier and much faster to type.
Instance.new("Script",game.Workspace) Instance.new("Script",game.Workspace) Instance.new("Script",game.Workspace)
Or you can do this:
i("Script",game.Workspace) i("Script",game.Workspace) i("Script",game.Workspace)
Tell me which is faster to type. I just wanted to give you a tip that you could do that with an instance so you can instance something faster. Sure wish I thought of that when I had to make a 420+ line script with instancing. A lot of Instances I can tell you, it was just one script and one ScreenGui that made it work like a pro. You can also do this with printing:
p = print p("Hia")
http://www.roblox.com/CeaselessSouls-Admin-Commands-Gui-based-item?id=92856199 -- Take one and enjoy! Read the description, has a lot of information. http://www.roblox.com/Forum/ShowPost.aspx?PostID=78242642 -- Read this no requests thread, this is all true. |
|
|
| Report Abuse |
|
|
|
| 21 Sep 2012 04:52 PM |
No! Use local variables! Use:
local i = Instance.new()
It's better, and more efficient that way! |
|
|
| Report Abuse |
|
|
|
| 21 Sep 2012 04:53 PM |
Don't use the () though, I don't care much for local, though. Here you go guys, I just made an instancing function:
function instance(ob,place) Instance.new(ob,place) end instance("Script",game.Lighting)
This could be useful in some way, it's your choice.
http://www.roblox.com/CeaselessSouls-Admin-Commands-Gui-based-item?id=92856199 -- Take one and enjoy! Read the description, has a lot of information. http://www.roblox.com/Forum/ShowPost.aspx?PostID=78242642 -- Read this no requests thread, this is all true. |
|
|
| Report Abuse |
|
|
pwnedu46
|
  |
| Joined: 23 May 2009 |
| Total Posts: 7534 |
|
|
| 21 Sep 2012 04:54 PM |
| Why would you replace something that has an obvious meaning with an obscure variable like i? |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 21 Sep 2012 04:55 PM |
| That would be bad coding. On some occasions people make a variable to represent math.abs (as just "abs") but doing this with all "built in" functions is bad habit |
|
|
| Report Abuse |
|
|
|
| 21 Sep 2012 04:57 PM |
pwn, why not? It's just an easy way, I personally wouldn't use it, but some people may. Same with my built-in function, I may not use them often at all, but some people may. Now, here's a printing function:
a = 11 function p(content) print(content) end p("Lol"..a.."lol")
Just a small example, but like I said, I may never use this. It just could come in handy sometime, you never know.
http://www.roblox.com/CeaselessSouls-Admin-Commands-Gui-based-item?id=92856199 -- Take one and enjoy! Read the description, has a lot of information. http://www.roblox.com/Forum/ShowPost.aspx?PostID=78242642 -- Read this no requests thread, this is all true. |
|
|
| Report Abuse |
|
|
|
| 21 Sep 2012 05:00 PM |
If you don't practice this, why give the information to other people?
[[ Don't tab, its ugly and inefficient.
I do, but you shouldn't. ]] |
|
|
| Report Abuse |
|
|
|
| 21 Sep 2012 05:02 PM |
Wow, I got mixed up my words terribly.
But, I think you understood the point. :l |
|
|
| Report Abuse |
|
|
|
| 21 Sep 2012 05:05 PM |
Dark, what now? The only thing I understood was the information part, but I gave it to them because some people may want to know or may not know and want an easier way to do this. I don't do this because I just like my code shorter without variables such as:
a = game.Workspace
BUT I am fine with:
a = 10
http://www.roblox.com/CeaselessSouls-Admin-Commands-Gui-based-item?id=92856199 -- Take one and enjoy! Read the description, has a lot of information. http://www.roblox.com/Forum/ShowPost.aspx?PostID=78242642 -- Read this no requests thread, this is all true. |
|
|
| Report Abuse |
|
|
|
| 21 Sep 2012 05:10 PM |
Shorter?
'a = game.Workspace' IS shorter.
If you're aiming for the amount of lines, then yes.
But you should be aiming for the least amount of characters.
Though, readability is the most important, naming variables single characters can be confusing (most of the time).
|
|
|
| Report Abuse |
|
|