KAAK82
|
  |
| Joined: 06 May 2014 |
| Total Posts: 1166 |
|
|
| 02 May 2015 05:49 PM |
I'd like to know, is there any way of checking an Object for a Property with something in it? like some Property that contains 'Value', 'Force', 'Color' etc etc... |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 May 2015 06:07 PM |
| No supported way, you're gonna either have to do pcall or have a table of all the classes and their properties |
|
|
| Report Abuse |
|
|
KAAK82
|
  |
| Joined: 06 May 2014 |
| Total Posts: 1166 |
|
| |
|
|
| 02 May 2015 06:21 PM |
| cnt you have to be kidding me? You could just try indexing it with string manipulation. I call that supported (Even if it uses pcall) |
|
|
| Report Abuse |
|
|
KAAK82
|
  |
| Joined: 06 May 2014 |
| Total Posts: 1166 |
|
| |
|
KAAK82
|
  |
| Joined: 06 May 2014 |
| Total Posts: 1166 |
|
|
| 02 May 2015 06:29 PM |
| war, make a Module that checks for a Property using :match() XD |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 May 2015 08:51 PM |
| Oh I read what OP said incorrectly. I thought he wanted to check if a property exists ;[ |
|
|
| Report Abuse |
|
|
| |
|
KAAK82
|
  |
| Joined: 06 May 2014 |
| Total Posts: 1166 |
|
|
| 02 May 2015 08:57 PM |
lol... cnt, I needa find a Property that has 'something' in it (Secret for now) and if it has it, then I'll needa finda the most efficent way to check that Property for it's Value... |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 May 2015 08:59 PM |
if part.propertyhere:match("thatsomething") then
Hopefully I understand correctly, but if you have, say a StringValue and you want to check if its value contains something then ^ |
|
|
| Report Abuse |
|
|
KAAK82
|
  |
| Joined: 06 May 2014 |
| Total Posts: 1166 |
|
|
| 02 May 2015 09:13 PM |
example:
local test = object.findSomeSortOf(lets say Torque, maxTorque, just Torque, etc etc) table.insert(stuff, test)--this line doesn't matter |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 May 2015 09:15 PM |
Do you know what "someSortOf" is, if so you can just do something like: local something = "Name" local test = stringvalue[something]
test would be the stringvalue's Name |
|
|
| Report Abuse |
|
|
KAAK82
|
  |
| Joined: 06 May 2014 |
| Total Posts: 1166 |
|
|
| 02 May 2015 09:18 PM |
k, lets say this
if test[PropertyContains'Id'] then... get me?
if 'Id' is included in the name of a property... cos am checking every Descendant of Game for stuff... |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 May 2015 09:21 PM |
| So why wouldn't match work (what I did above)? |
|
|
| Report Abuse |
|
|
KAAK82
|
  |
| Joined: 06 May 2014 |
| Total Posts: 1166 |
|
|
| 02 May 2015 09:26 PM |
cos... I think ur inspecting a StringValue.Value (A String)... am inspecting ANY Object, if it has a Property with 'Id' in it's Name then do stuff... |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 May 2015 09:27 PM |
Yeah just change it to .Name instead of .Value So:
if object.Name:match("Id") then print("Has Id in its name"); end |
|
|
| Report Abuse |
|
|
|
| 02 May 2015 09:27 PM |
| Would EinsteinK's API parser work here? Because I honestly still have no idea what you are doing, even after reading every reply. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 May 2015 09:29 PM |
| I never used his, I made one a while ago and it's a free model anyways (it's pretty bad but I could care less since it gets the job done and is not meant to be run 100 times a second). |
|
|
| Report Abuse |
|
|
KAAK82
|
  |
| Joined: 06 May 2014 |
| Total Posts: 1166 |
|
|
| 02 May 2015 09:31 PM |
cnt, can't be done... wat if object.This doesn't exist? and anyway, am looking for AnimationId, TextureId, etc... so I can't do object.AnimationId:match() :P as I said, am checking if there is such a property with 'Id' in it (one of those that I said, AnimationId, TextureId, etc) if anyPropertyOfObjectHas'Id'InItsName then --stuff end |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 May 2015 09:31 PM |
Yeah so you need a table of all the properties then. Lemme gen. one 1 sec. |
|
|
| Report Abuse |
|
|
|
| 02 May 2015 09:32 PM |
EinsteinK's gets the latest API data from Anaminus's github and parses it into a bunch of cool stuff such as a list of classes and Instances (And their superclasses and subclasses), a table containing every property, a table containing every method, and tons of other cool stuff.
For example, if you had the ClassName of an Instance, you could find out it's subclasses (For example, Seat is a subclass of Part), and you could find out all the properties existing for that specific ClassName.
I'll bet it works with Vector3s and stuff too, but I've only ever used it for Instances. |
|
|
| Report Abuse |
|
|
KAAK82
|
  |
| Joined: 06 May 2014 |
| Total Posts: 1166 |
|
|
| 02 May 2015 09:32 PM |
| do u know ALL the Properties that contain 'Id' in their name at least? |
|
|
| Report Abuse |
|
|
KAAK82
|
  |
| Joined: 06 May 2014 |
| Total Posts: 1166 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 May 2015 09:34 PM |
Yeah that wouldn't be hard to make but I don't need something like that :)
OP: pastebin/iaGM1qPV Uhm, all of them that contain ID? You can use a loop and remove all of them that don't from that big table ^ |
|
|
| Report Abuse |
|
|
|
| 02 May 2015 09:35 PM |
Oh, then here. local Classes = require(185389806).Classes --------- for Index, Value in pairs(Classes[ClassName].Properties) do if Index:match("Id") then -- Do stuff with Value, the property, and Index, the property index (Or "name", as you called it) end end |
|
|
| Report Abuse |
|
|