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



Reply to topic  [ 4 posts ] 
 Code pruning 
Author Message
User avatar

Joined: Sun Jun 10, 2007 2:05 am
Posts: 426
Reply with quote
Post 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.


Tue Aug 10, 2010 7:59 am
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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.


Tue Aug 10, 2010 8:09 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post 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.


Tue Aug 10, 2010 8:34 am
Profile WWW
User avatar

Joined: Sun Jun 10, 2007 2:05 am
Posts: 426
Reply with quote
Post Re: Code pruning
Ah, so if presetname = X, then variable = y? That's only an extra line of code, cool.


Tue Aug 10, 2010 7:54 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.131s | 14 Queries | GZIP : Off ]