Lua declarations: type registrations by their value type

オープン
#653 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
30/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
lua, rust

調査の方向性

Start with the generated Lua declarations and the bindings used by World.get_type_by_name, get_component, get_resource, bms.construct, and get_asset; the issue gives no file paths. Check the LuaLS diagnostics from the stated --check run, then study the open pull request #661 and the type-table issue mentioned here. Done means registrations and values carry useful inferred types and the reported type mismatches and undefined-field diagnostics are addressed.

索引モデルが issue の本文から書いたものです。

説明

Found by running LuaLS 3.19.2 --check over assets/tests/**/*.lua against declarations generated with all bevy_*_bindings features + lua54 + register_test_functions (454 problems in 92 files at the time).

Problem

Registrations carry no value type, so values from the world are untyped (~150 diagnostics).

  • World.get_type_by_name returns bms.ScriptTypeRegistration | bms.ScriptComponentRegistration | bms.ScriptResourceRegistration | bms.ScriptBundleRegistration | nil, while add_default_component, get_resource, insert_bundle, etc. take one specific registration → param-type-mismatch on nearly every test using a registration.
  • get_component / get_resource / bms.construct / get_asset return plain ReflectReference, so e.g. child_of:parent(), res.vec_usize, constructed.foo, reference:rotate_y(1.0) are undefined-field / inject-field.

Possible direction

Generic registrations (verified working in LuaLS, t infers transform.Transform|nil):

---@class bms.ScriptComponentRegistration<T> : ReflectReference
---@generic T
---@param registration bms.ScriptComponentRegistration<T>
---@return T | nil
function World.get_component(entity, registration) end

Open question: how a string lookup produces T — generated literal overloads per registered type on get_type_by_name, or only typing namespace type tables (see the type-table issue).

主要言語
Rust
スター
660
フォーク
59
平均マージ
16時間 23分
マージ済み PR(30日)
61

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

makspll/bevy_mod_scripting のほかの issue

makspll/bevy_mod_scripting の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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