Data Realms Fan Forums
http://45.55.195.193/

Code pruning
http://45.55.195.193/viewtopic.php?f=73&t=19483
Page 1 of 1

Author:  Solace [ Tue Aug 10, 2010 7:59 am ]
Post subject:  Code pruning

To cut way down on clutter, can you define a variable your Lua script uses but can be set in an ini? For example, if I want a Lua function on three different guns to have three ranges without having to triplicate the code just to change the ranges.

Author:  Grif [ Tue Aug 10, 2010 8:09 am ]
Post subject:  Re: Code pruning

No, but you could have the same script run by all three guns and have the script check the presetname of the gun.

Author:  Geti [ Tue Aug 10, 2010 8:34 am ]
Post subject:  Re: Code pruning

Or better, have it defined as a multiple of SharpRange or something so you don't have to do a pile of ifs in an attempt to cut down on clutter.

Author:  Solace [ Tue Aug 10, 2010 7:54 pm ]
Post subject:  Re: Code pruning

Ah, so if presetname = X, then variable = y? That's only an extra line of code, cool.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/