ChoicescriptIDE / ChoicescriptIDE/cslib

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

オープン
#44 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement good first issue
主要言語
JavaScript
スター
6
フォーク
3
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。