View unanswered posts | View active topics It is currently Fri Dec 27, 2024 7:52 am



Reply to topic  [ 7 posts ] 
 Adding an object as a gib with lua. 
Author Message
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Adding an object as a gib with lua.
How do you or can you do that?


Mon Oct 12, 2009 8:12 am
Profile WWW
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post Re: Adding an object as a gib with lua.
Code:
function Destroy(self)
  local particle = CreateMOSRotating("blah")
  particle.Pos = self.Pos
  particle.Vel = self.Vel
  MovableMan:AddParticle(particle)
end
Though this happens also upon settling and Lifetime running out.


Mon Oct 12, 2009 1:36 pm
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Adding an object as a gib with lua.
Can you do this?
Code:
function Update(self)
  self.somevariable = whatever
end

function Destroy(self)
  local particle = CreateMOSRotating("self.somevariable blah")
  particle.Pos = self.Pos
  particle.Vel = self.Vel
  MovableMan:AddParticle(particle)
end

Or would it be (self.somevariable "blah")?


Tue Oct 13, 2009 2:53 am
Profile WWW
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: Adding an object as a gib with lua.
It would be:
Code:
self.somevariable .. "blah"

The ".." operator is a concatenation operator, otherwise known as "put that onto the end of this".


Tue Oct 13, 2009 3:00 am
Profile WWW
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Adding an object as a gib with lua.
So the preset would be "blah whatever" if (self.somevariable .. "blah") in that case, right?


Tue Oct 13, 2009 3:07 am
Profile WWW
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post Re: Adding an object as a gib with lua.
It's like addition. Whatever is to the left of the concat operator is what the part on the right is added to,
"Bleh" .. "Blah" = "BlehBlah"


Tue Oct 13, 2009 3:08 am
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Adding an object as a gib with lua.
Ooooh, I see. Thats very useful.


Tue Oct 13, 2009 3:14 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.048s | 13 Queries | GZIP : Off ]