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: Every object should have a empty table property.

Previous Thread :: Next Thread 
Radioaktiivinen is not online. Radioaktiivinen
Joined: 25 Apr 2009
Total Posts: 18629
26 Apr 2012 08:38 AM
A property that is a table where you can put anything you want to. It would be really useful to put data directly into models and parts instead of creating a table for each object type to find their data (which are usually in separate scripts so its annoying and messy to access the data)

Liek

Object.UserTable


or something.
Report Abuse
BenBonez is not online. BenBonez
Joined: 29 Aug 2008
Total Posts: 19362
26 Apr 2012 09:39 AM
Useful? Probably
Needed? No
Report Abuse
Radioaktiivinen is not online. Radioaktiivinen
Joined: 25 Apr 2009
Total Posts: 18629
26 Apr 2012 09:44 AM
But i dont want to fill stuff with value objects D:



Though i dont make stuff in roblox anymore really o,e
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
26 Apr 2012 09:45 AM
[ Content Deleted ]
Report Abuse
VorenKurn is not online. VorenKurn
Joined: 18 Jun 2008
Total Posts: 48
26 Apr 2012 09:51 AM
Yes, every object should have something like that. I want for the Parent structure class of roblox to need twice as much CPU to operate every individual brick just because it has to index the children/parent of every object AND an entire list of possibly endless variables of any type.

On a less satiric note, yes it would be useful, no it would be extremely impractical. Just use the ValueTypes, they will work for what you need, just keep it reasonable.
Report Abuse
iNigerian is not online. iNigerian
Joined: 17 Apr 2012
Total Posts: 165
26 Apr 2012 11:50 PM
:o
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
26 Apr 2012 11:55 PM
Oysi's solution is the best.
Report Abuse
iNigerian is not online. iNigerian
Joined: 17 Apr 2012
Total Posts: 165
27 Apr 2012 12:07 AM
its better if it works on local and server script
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
27 Apr 2012 01:06 AM
The problem is replication. You can't replicate functions, or even recursive data structures very easily, so it would have to be a copy-by-value scheme. You can't have it pass by reference like a standard table due to GC and replication problems. Every table that's a child of it would have to be a real Roblox object in order to be replicated. See the following:

a = {b = {c=1}}
game.Data.Item1 = a

--now, how does Roblox know to replicate the change, this is pure Lua code. The
--only option would be to have every table maintain some internal replication code,
--which is kind of expensive... and by that I mean really expensive.
a.b.c = 5

So, in short, even if it were done it would not be as nice as you're thinking of.
Report Abuse
smurf279 is not online. smurf279
Joined: 15 Mar 2010
Total Posts: 6871
27 Apr 2012 01:56 AM
special_props = {}
local obj = {real_obj = ...}

setmetatable(obj, {
__newindex = function(self, prop, val)
special_props = coroutine.resume(coroutine.create(function() self.real_obj.prop = val end)) and nil or val
end,
__index = function(self, prop)
return coroutine.resume(coroutine.create(function() return self.real_obj[prop]end)) or special_props[prop]
})


Something like that?
Report Abuse
LibyanFreedomFighter is not online. LibyanFreedomFighter
Joined: 17 Apr 2011
Total Posts: 1004
27 Apr 2012 11:26 AM
liek
Report Abuse
Radioaktiivinen is not online. Radioaktiivinen
Joined: 25 Apr 2009
Total Posts: 18629
27 Apr 2012 11:29 AM
But value objects feel so laggy and i dont want to create 10000 value objects to list some values when i could se a single nonlaggy table :c (no i dont need to do that)

Its just that storing the data separate from the actual objects always gets messy and stoof.
Report Abuse
Maelstronomer is not online. Maelstronomer
Joined: 07 Jun 2008
Total Posts: 7649
27 Apr 2012 12:22 PM
I'd like to know more about Oysi's solution. Would someone like to explain more about it and give more examples? : )
Report Abuse
Radioaktiivinen is not online. Radioaktiivinen
Joined: 25 Apr 2009
Total Posts: 18629
27 Apr 2012 12:27 PM
He is just using parts as keys in a table, just like you can use strings or numbers or whatever (vectors,cframes... other tables?)

so that you can quickly get the data belonging to the part from a table like PartData[partinstance]
Report Abuse
trappingnoobs is not online. trappingnoobs
Joined: 05 Oct 2008
Total Posts: 19100
27 Apr 2012 12:31 PM
"I'd like to know more about Oysi's solution."

You're joking, right?

It's like possibly one of the most basic things you can do with tables.. :l
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
27 Apr 2012 01:56 PM
[ Content Deleted ]
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
27 Apr 2012 02:19 PM
"But value objects feel so laggy and i dont want to create 10000 value objects to list some values when i could se a single nonlaggy table :c (no i dont need to do that)"

The table would feel just as laggy by the time the game had done all of the work to make it have the same semantics as using value object. There is no silver bullet here guys, replication is hard... deal with it.
Report Abuse
JulienDethurens is not online. JulienDethurens
Joined: 11 Jun 2009
Total Posts: 11046
27 Apr 2012 03:07 PM
If you REALLY want to use a table, then...

Use a BindableFunction and make it return the table.
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