Raised This Month: $ Target: $400
 0% 

[TUT] Organizing Code for Beginners


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nergal
Veteran Member
Join Date: Apr 2012
Old 03-07-2015 , 14:21   Re: [TUT] Organizing Code for Beginners
Reply With Quote #1

Quote:
Originally Posted by aexi0n View Post
Quick Question. So my plugin is written with about 8 different files currently, and uses natives for needed information from each other. I'm trying to optimize the code completely, and make it so I have "myplugin_main", and include the other files such as "myplugin_hooks", "myplugin_commands", etc.

I've got this all working fine, but I have a question regarding which variables are usable. I know that the file "myplugin_main" will have access to all global vars from any of the other files it includes.

But in an included such as "myplugin_hooks", would I be able to use a global variable from another include file such as "myplugin_commands"

If so, is there some special way to do this? Can't seem to figure it out.
Why aren't your globals all in one include?

If you want a global variable modified by your entire plugin, u might as well compile your plugin with your globals being in one single file to be used by the rest of it.

If you're not going to use globals in each respective file, you have to use local variables or functions that modify and sent data to and fro.
__________________

Last edited by nergal; 03-07-2015 at 14:22.
nergal is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:34.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode