Jump to content

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


Go to solution Solved by Josh,

Recommended Posts

Posted

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

 

 

  • 2 months later...
  • Solution
Posted

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.

Let's build cool stuff and have fun. :)

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.

×
×
  • Create New...