Skip to content

Bundle support #105

@treytencarey

Description

@treytencarey

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Planned

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions