Data Realms Fan Forums http://45.55.195.193/ |
|
Basic Lua Question (total newb question) http://45.55.195.193/viewtopic.php?f=73&t=14900 |
Page 1 of 1 |
Author: | CherryT [ Sun May 24, 2009 6:29 am ] |
Post subject: | Basic Lua Question (total newb question) |
Code: function Create(self) local curdist = 100; self.parent = nil; for actor in MovableMan.Actors do local avgx = actor.Pos.X - self.Pos.X; local avgy = actor.Pos.Y - self.Pos.Y; local dist = math.sqrt(avgx ^ 2 + avgy ^ 2); if dist < curdist then curdist = dist; self.parent = actor; end end end (taken from the Dear Sister weapon) Does this mean: "When the Create function is called, take the following actions:" ? |
Author: | Grif [ Sun May 24, 2009 6:41 am ] |
Post subject: | Re: Basic Lua Question (total newb question) |
It means: when the object is created (since I am fairly sure the DS runs a script on the round fired) run the following script, which in this case determines the closest actor and calls it the parent. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |