SkriptLang / skript-reflect

Powerful reflection utilities for Skript.
MIT License
56 stars 19 forks source link

Add a way to create Java variables #105

Closed MissingReports closed 2 weeks ago

MissingReports commented 2 weeks ago

Is your feature request related to a problem? Please describe. I'm not sure if it's a problem but I think yes.

Describe the solution you'd like In some cases, if you want to get the output of a method that you call but the output is a java array that isn't registered as a Skript class, you won't be able to get the values, even if u do something like this 1st element out of... However, if there was a way to do something like this PlayerProfile[] profile = ... then it'd solve that issue and would also make it possible to create 2D or even 3D arrays like hippo, 2D or 3D arrays are used alot when messing with Skript addon development or if you want to do something with Skript without getting an addon (most addons are outdated). You might tell me "this isn't common", It isn't common but there must be a time where you wanted for example Skript evaluation to quickly test code, there isn't a single public addon that isn't outdated that does that at the moment, and to do that with reflect you would need 2D arrays.

Describe alternatives you've considered Maybe instead of doing all of that, make a way to create an array inside of an array and get the values. Maybe something like this set {_array} to new JavaArray(String.class, 2) and 2 being the dimensions. This won't be that effective as you still cannot access methods that return an actual array, a fix would be to make JavaArray(Object[]...).

Additional context image

erenkarakal commented 2 weeks ago

to get the value: {_arr}[0] or first element of ...{_arr} to create an array: [%objects% as %class%], ex. [1, 2, 3 as int] [{_prof} as ProfileProperty]