makspll / makspll/bevy_mod_scripting
Bundle support
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 649
- Forks
- 59
- PR merge metrics
- No merged PRs in 30d
Description
I am experimenting with bevy_mod_scripting, sorry for any confusion.
I want to display Text purely in Lua. Here's the code so far
--[[ "convenience to add a component by string type name and return the component handle" ]]
local function add_component(entity, type_name)
local t = world:get_type_by_name(type_name)
world:add_default_component(entity, t)
return world:get_component(entity, t)
end
function once()
local e = world:spawn()
local TextSection = world:get_type_by_name("TextSection")
print(TextSection) -- "ScriptTypeRegistration"
local TextStyle = world:get_type_by_name("TextStyle")
print(TextStyle) -- "ScriptTypeRegistration"
local text = add_component(e, "Text")
print(text) -- "Text { sections: [], alignment: Left, linebreak_behavior: WordBoundary }"
-- local text_section = add_component(e, "TextSection") -- error: TextSection is not a component
end
I am having troubles figuring out how to create a TextStyle and TextSection for use in my test.sections. Any ideas?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Lua example in the issue, especially world:get_type_by_name, add_default_component, and get_component, and trace how Text, TextStyle, and TextSection are registered. Done means a Lua script can construct the requested text data for Text.sections without treating TextSection as a component; no test or file is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, rust
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100