I need to help to create a piece of code that programmatically checks if something is a method or a function
So im creating a Visual scripting Plugin for Roblox Studio, which is really cool and should make coding more accessible for younger people.
So far ive gotten a big object tree with classes, enums, globals, librarys, etc. But the main issue im running into is that for stuff like Part:Destroy() or Part:Clone() my program would need to know if something is a method (which i guess need a colon) or a function (which i guess need a dot).
My solution would be to use PCall to execute a function which tests the validity of the method/function. So it tries : or . If one fails we know it must be the other.
But that is more simply said then done. For stuff like instances I cant do “Instance:Clone”, i have to get something that inherits Instance and then execute that Pcall. Trace this information back to the “Superclass” and apply it to that. From then on we know that it’s either a method or a function.
This… doesnt seem very efficient, i could make a program that does this once, saves it to JSON then gives it to me, but this would warrant regular maintaining, because im relying on a different APIdump for most of this data.
I was wondering what your guy’s take on this would be. Maybe you got something more efficient! Lets brainstorm about this together!
So Im just asking for ideas here not complete pieces of code, though that would be nice, im just asking for suggestions.
Ive basically already got a system, but it may not be a very efficient one…
Afaik there are no Instances or datatypes that use functions over methods. The only time functions are used are for libraries so, you should expect the user to call all functions of Instances/datatypes as methods.