Thanks to you @vknow360
When you use the toArray
or toStringArray
methods the *list*
element is dropped. This allows you to use 0-based indexing in Java like one would expect.
When returning a value, if you aren't planning to do sufficient type checking it is usually better to return a List<...>
rather than a YailList
. If you return List
, the runtime will check it automatically to ensure that its contents are acceptable for the blocks language. If you return YailList
, it is assumed you've taken the effort to check. This can lead to problems if you haven't sanitized the list data for the user.
I am trying to explain that use void instead of Yailist in
and you can take reference that @ewpatton said
What does that even do? You're not taking input whereas you're also not giving output...?
I had mistakenly left input..
In the case of output, you can use @SimpleEvent
Keep it simple as you can
@SimpleEvent(description = "")
public void GotItem(String item){
EventDispatcher.dispatchEvent(this, "GotItem", item);
}
@SimpleFunction(description = "")
public void SelectItem(YailList list, int index){
String item = "";
item = (String) list.get(index);
GotItem(item);
}
@AkshatRana is saying about this code...
The code is wrong. You should use get(INDEX)
method for YailList.
There are arrays and not list.
I didnt understand
Take a look here:
item = (get[index]);
Should we use like this.
Use like this:
String item = (String) list.get(INDEX);
Yess it can be!!
I have edited the code. See above
Is starts from 0 not 1
Anyone know how to fix this import in intelliij IDE??
it start from 1