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 个 reaction 已指派 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.

贡献指南

打开贡献指南

调研方向

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.

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
tooling
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。