[AI] cRoot:Get():ForEachMob
#12
The variables are global by default, but each plugin executes in its own sandbox, so you don't need to prefix by plugin name, that's kinda counter-productive. You might want to use file-local variables, though - if you declare a variable as "local" on the file level (without any enclosing function), the variable will be accessible to all the file's functions, but no-where else. This is useful for self-contained modules that have some form of a global state, so that they don't leak that state out.

Of course, getting into the habit of using as much "local" as possible is always a good thing. I think when the Core plugin was developed this idea hasn't been rooted too strong yet, so there's a lot of instances in Core that could use localising Smile
Reply
Thanks given by:


Messages In This Thread
[AI] cRoot:Get():ForEachMob - by wudles - 01-26-2015, 04:54 AM
RE: [AI] cRoot:Get():FindAndDoWithMob - by xoft - 01-26-2015, 04:57 AM
RE: [AI] cRoot:Get():FindAndDoWithMob - by wudles - 01-26-2015, 05:01 AM
RE: [AI] cRoot:Get():ForEachMob - by xoft - 01-26-2015, 05:21 AM
RE: [AI] cRoot:Get():ForEachMob - by wudles - 01-26-2015, 01:32 PM
RE: [AI] cRoot:Get():ForEachMob - by wudles - 01-26-2015, 02:42 PM
RE: [AI] cRoot:Get():ForEachMob - by xoft - 01-26-2015, 06:47 PM
RE: [AI] cRoot:Get():ForEachMob - by wudles - 01-27-2015, 01:00 AM
RE: [AI] cRoot:Get():ForEachMob - by xoft - 01-27-2015, 01:39 AM
RE: [AI] cRoot:Get():ForEachMob - by wudles - 01-27-2015, 03:02 AM
RE: [AI] cRoot:Get():ForEachMob - by wudles - 01-27-2015, 12:31 PM
RE: [AI] cRoot:Get():ForEachMob - by xoft - 01-27-2015, 06:21 PM



Users browsing this thread: 3 Guest(s)