generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Instance.new() should have a third argument

Previous Thread :: Next Thread 
teteyal is not online. teteyal
Joined: 01 May 2011
Total Posts: 274
22 Aug 2012 01:21 PM
Instance.new("Part");
Instance.new("Part",Workspace);
Instance.new("Part",Workspace,"Brick");

The third argument should be what the object will be named as.
Report Abuse
ap3ratesl3fe is not online. ap3ratesl3fe
Joined: 02 Apr 2012
Total Posts: 822
22 Aug 2012 01:21 PM
Yes.
Report Abuse
BlueTaslem is not online. BlueTaslem
Joined: 11 May 2008
Total Posts: 11060
22 Aug 2012 01:21 PM
I agree. But it really is just completely unnecessary.

Also, does anyone know when exactly the second argument was added? Was it always there and just no one knew?
Report Abuse
ap3ratesl3fe is not online. ap3ratesl3fe
Joined: 02 Apr 2012
Total Posts: 822
22 Aug 2012 01:23 PM
Idk. I found out about the second argument a month ago, along with how 'Workspace' by itself doesn't need a capital.

~You just lost the game.
Report Abuse
teteyal is not online. teteyal
Joined: 01 May 2011
Total Posts: 274
22 Aug 2012 01:26 PM
@blue

Well it can make things easier though instead of making that Instance()'d object a variable and making another statement saying what the name of it is. And I have no idea when it was added.

@ap

Same, I found it about 3-4 months ago.
Report Abuse
su8qqingcuzbanned is not online. su8qqingcuzbanned
Joined: 28 Jul 2012
Total Posts: 164
22 Aug 2012 01:28 PM
we need third argument like dis

Instance.new("Part",blah,{Name = "Bob",Transparency = .5})
Report Abuse
Luc599345 is not online. Luc599345
Joined: 25 Jul 2008
Total Posts: 1169
22 Aug 2012 01:30 PM
@su8

Yes. Totally. Seriously.
Report Abuse
teteyal is not online. teteyal
Joined: 01 May 2011
Total Posts: 274
22 Aug 2012 01:30 PM
Eh..

I've also thought that there should be a "Touching" event, where while an object is touching the object, it will execute its function.
Report Abuse
Luc599345 is not online. Luc599345
Joined: 25 Jul 2008
Total Posts: 1169
22 Aug 2012 01:32 PM
@teteyal

No. Not that :(
Report Abuse
teteyal is not online. teteyal
Joined: 01 May 2011
Total Posts: 274
22 Aug 2012 01:34 PM
Why not? I want to do things like having my own "water" object, instead of that ROBLOX terrain version, and I want to create an underwater GUI effect and stuff.
Report Abuse
su8qqingcuzbanned is not online. su8qqingcuzbanned
Joined: 28 Jul 2012
Total Posts: 164
22 Aug 2012 01:35 PM
or

part:Intersects(otherpart)
Report Abuse
Techboy6601 is not online. Techboy6601
Joined: 29 Jun 2009
Total Posts: 4914
22 Aug 2012 01:38 PM
is this

Instance.new("Part", Workspace).Name = "Brick"


Really that hard?
Report Abuse
Legend26 is not online. Legend26
Joined: 08 Sep 2008
Total Posts: 10586
22 Aug 2012 01:39 PM
It's been there at LEAST since August 10, 2010 although it could very well have been there since the beginning of time for all we know.
Report Abuse
teteyal is not online. teteyal
Joined: 01 May 2011
Total Posts: 274
22 Aug 2012 01:41 PM
@tech

Ewww.. more characters to type in.
Report Abuse
IdJustLike2Interject is not online. IdJustLike2Interject
Joined: 18 Aug 2012
Total Posts: 3
22 Aug 2012 01:42 PM
I'd just like to interject for a moment. What you're referring to as new(), is in fact, Instance.new(), or as I’ve recently taken to calling it, Instance plus new(). new() is not a function unto itself, but rather another free component of a fully functioning Instance system made useful by the Instance metatables, Roblox classes and vital system components comprising a full function.

Many computer users run a modified version of the Instance system every day, without realizing it. Through a peculiar turn of events, the version of Instance which is widely used today is often called “new()”, and many of its users are not aware that it is basically the Instance system, developed by the Instance Project.

There really is a new(), and these people are using it, but it is just a part of the system they use. new() is the member: the function in the object that allocates the machine’s resources to the other scripts that you run. The new() is an essential part of an Instance, but useless by itself; it can only function in the context of a complete Instance object. new() is normally used in combination with the Instance object: the whole function is basically Instance with new() added, or Instance.new(). All the so-called “new()” distributions are really distributions of Instance.new().
Report Abuse
su8qqingcuzbanned is not online. su8qqingcuzbanned
Joined: 28 Jul 2012
Total Posts: 164
22 Aug 2012 01:43 PM
will you shut up ignorant spammer who can't script
Report Abuse
TheMyrco is not online. TheMyrco
Joined: 13 Aug 2011
Total Posts: 15105
22 Aug 2012 01:47 PM
This belongs in Suggestion and Ideas, thanks for understanding.
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
22 Aug 2012 02:12 PM
Or you could use my Create function if you want more control:

local RbxUtility = LoadLibrary('RbxUtility')
local Create = RbxUtility.Create

local part = Create'Part'{
Parent = game.Workspace;
Name = 'Blah Part';
BrickColor = BrickColor.new(21);
}

It's even in RbxUtility so you'll always have it at you fingertips. Adding more arguments to Instance.new is just API bloat, I would lobby against it. I even dislike it having a parent argument.
Report Abuse
RenderSettings is not online. RenderSettings
Joined: 16 Aug 2010
Total Posts: 2560
22 Aug 2012 02:48 PM
@stravant Wait, I'm pretty sure that the roblox gameservers load that on startup =O
Report Abuse
SN0X is not online. SN0X
Joined: 24 Oct 2011
Total Posts: 7277
22 Aug 2012 02:58 PM
Nah, well sure, that works too, but a simpler way would be what su8 suggested. in fact, keep the 2 arguments, but if the 2nd argument is not a table, but an object, then it is set to the new object's part

otherwise,

Instance.new(String Objectclassname, {properties})

like

Instance.new("Textlabel",{Parent = Game.Players.SN0X.PlayerGui.ScreenGui, Size = UDim2.new(1,0,1,0), Text = "TROLOLLOLOLOLOL", BackgroundColor3 = Color3.new(255,255,255), TextScaled = true}
)

That would be AWSUMMM :DDDDD
Report Abuse
Candymaniac is not online. Candymaniac
Joined: 08 Oct 2009
Total Posts: 8985
22 Aug 2012 03:08 PM
Instance.new("Brick,{Parent = game.Workspace, Name = "Hello", etc.}

☜▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☜☆☞▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☞ - Candymaniac, a highly reactive substance.
Report Abuse
SN0X is not online. SN0X
Joined: 24 Oct 2011
Total Posts: 7277
22 Aug 2012 03:10 PM
^

...right.........
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
22 Aug 2012 03:10 PM
Note that my solution also handles children. You can build a whole hierarchy with it:

Create'Model'{
Name = 'Thing';
Create'Part'{
Name = 'SomePart';
Create'SpecialMesh'{
MeshId = '...';
};
};
}

Very succinct way of stating and building a hierarchy in code. Putting that into the core API is too much of a stretch though, the API should provide just what's needed, not a lot of sugar like that, which should go into the libraries instead.
Report Abuse
SN0X is not online. SN0X
Joined: 24 Oct 2011
Total Posts: 7277
22 Aug 2012 03:22 PM
>Putting that into the core API is too much of a stretch though, the API should provide just what's needed, not a lot of sugar like that, which should go into the libraries instead.

I disagree...in my oppinion, development here in ROBLOX should be as easy, quick and comfertable as possible.

But yeah, that's pretty neat. Still long and library-yy though. PUT IT IN INSTANCE.NEW() PL0X!
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
22 Aug 2012 03:26 PM
"development here in ROBLOX should be as easy, quick and comfertable as possible."

Yes, and stuff like what I posted should be implemented Lua side, as libraries, not in the C API (Where it would probably even be slower than if made on the Lua side due to the extra interop costs).

If you could just say LoadLibrary('RbxUtility').ImportAll() and have all those nice things that would be much better than having them in the C API.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image