ChoicescriptIDE / ChoicescriptIDE/cslib

Extend cslib_object's get_by_field and get (by index) methods to take a custom main instance prefix

Đang mở
#44 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement good first issue
Ngôn ngữ chính
JavaScript
Star
6
Fork
3
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Currently both of these functions expect you to have a single "main" instance, consisting of a

For example, for this definition:
```
*create dragon_id ""
*create dragon_field_1 "name"
*create dragon_field_2 "hit_points"
*create dragon_field_max 2
```

You're expected to define:
```
*create dragon_name ""
*create dragon_hit_points ""
```

And this is where both get routines will put the relevant values, when called as normal:
```
*gosub_scene cslib_object get "dragon" 2
or
*gosub_scene cslib_object get_by_field "dragon" "name" "Locke"
```

It should be possible to add an extra parameter to both of the get functions which allows the user to specify a custom main instance with a different name, e.g.:

```
*gosub_scene cslib_object get "dragon" 2 "baby_dragon"
or
*gosub_scene cslib_object get_by_field "dragon" "name" "Locke" "baby_dragon"
```

These two examples would attempt to populate the following variables (instead of the object-named main instance):
```
*create baby_dragon_name ""
*create baby_dragon_hit_points ""
```

Of course, this name could be any valid string: giving a lot of flexibility back to the user.
For backwards compatibility (and convenience), if this last parameter isn't provide, we should still default to the main instance.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Locate the cslib_object get and get_by_field entry points and read how they currently derive the object-named main instance. Verify that an optional custom prefix populates the requested variables while omitted parameters retain the existing default behavior, using the example calls and variable names in the issue as the completion check.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript
Lĩnh vực
tooling
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.