Jump to content

Close Leadwerks script Lua??


Yue
 Share

Go to solution Solved by macklebee,

Recommended Posts

Script.Vehiculo = nil --entity "Malla Vehiculo"
 

-- Tires
local llantas = {}


function Script:Start()
	
	

	
	
	for indice = 1, self.Vehiculo:CountChildren() do
		
		llantas[ indice ] = self.Vehiculo:GetChild( indice )
		
		llantas[ indice  ]:Hide()
		
	end
	
	

end

The previous scripts in lua close unexpectedly leadwerks.

What am I doing wrong? Any suggestions?

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

  • Solution

I would assume its due to trying to hide an entity that doesn't exist. Start your indice at 0 and decrement the loop's end value by 1.

for indice = 0, self.Vehiculo:CountChildren() - 1   do
	llantas[ indice ] = self.Vehiculo:GetChild( indice )
	llantas[ indice  ]:Hide()
end

Also - you should learn to use System:Print() as its a very useful troubleshooting command. Use it to see where your code is failing and what the status of a variable is when the code stops working. It will save yourself some time instead of having to post asking questions on how to troubleshoot your own code.

  • Like 1

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

 

4 minutes ago, macklebee said:

I would assume its due to trying to hide an entity that doesn't exist. Start your indice at 0 and decrement the loop's end value by 1.


for indice = 0, self.Vehiculo:CountChildren() - 1   do
	llantas[ indice ] = self.Vehiculo:GetChild( indice )
	llantas[ indice  ]:Hide()
end

Also - you should learn to use System:Print() as its a very useful troubleshooting command. Use it to see where your code is failing and what the status of a variable is when the code stops working. It will save yourself some time instead of having to post asking questions on how to troubleshoot your own code.

I appreciate your answer, and I apologize if my questions bother you since I'm a rookie.

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

6 minutes ago, Yue said:

I appreciate your answer, and I apologize if my questions bother you since I'm a rookie.

Not a bother - but some of the questions you post could be answered easily by yourself if you learn how to do simple troubleshooting. Think how much farther along you could get in your project if you didn't have to post constantly and wait for someone to tell you the answer, if only you could learn how to start troubleshooting your own code. The link to System:Print() was meant to help you as it appears you are new to programming in general. 

  • Thanks 1

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

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...