MrSquer
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 6103 |
|
|
| 15 Sep 2015 04:53 PM |
For example, something like this:
for i, v in pairs(Instance, maybe Instance:GetChildren()) do print(i,v) --ClassName, Part end |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 04:55 PM |
| You will want to have a look at EinsteinK's API parser. It is updated frequently (As frequently as Anaminus's site is updated), and it tells you the properties and methods and such for a particular class. |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 04:56 PM |
No, but you CAN do it the other way around.
tab = {Size=Vector3.new(1,1,1),BrickColor=BrickColor.new("Really red"),Transparency=1} part = Instance.new("Part",workspace)
for i,v in pairs(tab) do part[i]=v end |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 04:58 PM |
| Well, you CAN do it without an API parser, but idk if you want to brute-force class members each time or not. |
|
|
| Report Abuse |
|
|
MrSquer
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 6103 |
|
|
| 15 Sep 2015 05:02 PM |
hm. I was planning on making a useful function. It'd take your selection in studio and convert those properties into code, that, when placed into a script, actually works and produces an exact replica of the original instance. I'm making this because I like to frame out what my GUIs will look like before I actually code it. The function looks a little bit like this right now:
AutoProperties = function() local BackupVariable = game.Workspace local AutoVariable = game.Selection:Get()[1] or BackupVariable or nil if AutoVariable == nil then return nil end local CurrentCode = "local "..AutoVariable.Name.."=Instance.new(\""..AutoVariable.ClassName.."\","..AutoVariable.Parent:GetFullName()..")" return(CurrentCode) end
print(AutoProperties()) |
|
|
| Report Abuse |
|
|
MrSquer
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 6103 |
|
|
| 15 Sep 2015 05:06 PM |
also, @phoenix53124:
Hi, I'm earth. Have we met? |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 15 Sep 2015 05:08 PM |
^ lol ikr
yeah a :GetProperties would be pretty cool but otherwise you'll have to save the existing properties and load them (or load someone else's) |
|
|
| Report Abuse |
|
|
MrSquer
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 6103 |
|
|
| 15 Sep 2015 05:25 PM |
| hm, so do I have to use the XML metadata for now? |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 08:38 PM |
Nope, just parse this as json. http://jacob.easleycompany.com/api/apidump |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 08:47 PM |
This might be what you want: pastebin/zjPucx8E Just loop through the properties table and see if it exists on an instance. |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 08:56 PM |
Just use EinsteinK's API Parser it's super simple and contains all you will likely need that is relevant to this thread. |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 15 Sep 2015 08:58 PM |
| ^ it's not like dennis' solution would work anyway |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 08:59 PM |
| I DID SOMETHING LIKE THIS LET ME GIVE IT TO U |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 09:00 PM |
| Mine works m8s. Any language where you can parse json (hint: pretty much every language) |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 09:02 PM |
function F.WholeLerp(ob,prop,coro,steps,t,target,start) local function go() local org=start or ob[prop] for i=1,steps do ob[prop]=(org+(target-org)*(i/steps)) wait(t/steps) end end if coro then spawn(go) else go() end end F.WholeLerp(Gui,'Rotation',true,4,.1,0)
|
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 09:07 PM |
| @lordrambo Why wouldn't it work? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 15 Sep 2015 09:07 PM |
| Because he wants properties of an object, not all properties that exist in general. |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 09:09 PM |
| Just try to pcall return it and see if it exists on an instance. One downside is if you happen to have an instance with the name of one of those properties. |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 15 Sep 2015 09:10 PM |
ugh why you make me explain myself
what do you plan to iterate through every single property to see if it belongs to a class using pcall to dodge the errors and then print whatever the value is? terrible and inefficient |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 09:10 PM |
With mine: JsonDecodedTable.Class[ClassName].PropertyMap |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 09:11 PM |
| Never said it was efficient. |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 15 Sep 2015 09:12 PM |
but it's so stupid to do it that way when you could just use a precompiled list of instance's and their respective properties
OR when you can use an api dump that actually updates |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 09:13 PM |
"but it's so stupid to do it that way when you could just use a precompiled list of instance's and their respective properties
OR when you can use an api dump that actually updates"
So use mine |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 09:13 PM |
| Yes, you definitely could. I was just providing one way of doing it. I didn't say it's the best way of doing it. |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 15 Sep 2015 09:14 PM |
| well I you realize you answered an already answered question with a much worse solution, which is why you got called out on it |
|
|
| Report Abuse |
|
|