Jump to content

LUA: self.entity:FindChild("p*") returns nil, self.entity:FindChild("p*", results) does not exist.


beo6
 Share

Go to solution Solved by Josh,

Recommended Posts

I am trying to get all Entities children that start with a name:

 

function MyComponent:Start()
    local targets = self.entity:FindChild("p*")
end

 

This does not work. targets will always be "nil".

and as in the documentation

 

function MyComponent:Start()
    local results
    local targets = self.entity:FindChild("p*", results)
end

 

does not work because there is no function with that amount of arguments.

What works is using the full name without any placeholders:

 

function MyComponent:Start()
    local targets = self.entity:FindChild("p1")
end

 

 

Link to comment
Share on other sites

  • 2 months later...
  • Solution

For some reason the wildcard matching was disabled. I fixed this.

The command for finding multiple entities is FindChildren. I am updating the documentation now.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...