Add Actor.GetComponent(type) and align Actor.GetBehaviour(type) API#778
Add Actor.GetComponent(type) and align Actor.GetBehaviour(type) API#778Gopmyc wants to merge 2 commits intoOverload-Technologies:mainfrom
Actor.GetComponent(type) and align Actor.GetBehaviour(type) API#778Conversation
|
Not exactly what I had in mind. By For example, in ---@meta
--- Represents the 3D transformations applied to an actor
---@class Transform : Component
Transform = {}That should allow us to do something like that in a script: function MyScript:OnStart()
self.owner:GetComponent(Transform)
endSince Not sure if it's even possible, but we should definitely investigate. |
That would mean polluting Lua's global table with lots of elements like |
|
@Gopmyc wdym pollute the global table? These user types are already defined in the global table: LuaComponentBindings.cpp and captured by the LSP thank to the LuaLS definitions |
Description
This PR adds a generic
Actor:GetComponent(type)binding to the Lua API and updates the Lua Actor stubs accordingly.Changes included:
Actor:GetComponent(type)in Lua bindings (LuaActorBindings.cpp).nil.GetBehaviourparameter naming totypein bindings and Lua stubs for API consistency.Resources/Engine/Lua/Scene/Actor.luato expose:Actor:GetComponent(type)Actor:GetBehaviour(type)Related Issue(s)
Fixes #777
Review Guidance
Please focus review on:
Actor:GetComponent(type).nilwhen type is unknown or missing).Screenshots/GIFs
N/A
AI Usage Disclosure
Generated new code / Documentation (I did the refactoring)
Checklist