AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [Request] Global Static Constant Declaration (https://forums.alliedmods.net/showthread.php?t=306024)

dustinandband 03-13-2018 04:10

[Request] Global Static Constant Declaration
 
https://github.com/TGMaster/Scriptin...lerpmonitor.sp

Lines 31 - 52

I'm curious what the purpose of using the "static" type gives for these global constants, handles, and booleans?

The Sourcemod documentation on static variables was too short and the only other thread I was able to find on the subject of 'static types' was in the AMX Mod Snippets thread, also from 2006, so I'm not sure if it's relevant to sourcemod.

hmmmmm 03-13-2018 05:24

Re: [Request] Global Static Constant Declaration
 
This isn't a snippet or a tutorial so you're asking in the wrong section.
Regardless, static when in global namespace means that it can't be used by other files that include that file although it seems pretty useless in that context. AFAIK its generally used for include files (.inc) so as not to pollute global namespace.

Also the const is pretty useless for global variables from what I understand, only usable in function params.

xXDeathreusXx 05-02-2018 22:21

Re: [Request] Global Static Constant Declaration
 
The static context is the same for SourceMod as it is AMXMod and that thread is more or less up to date as nothing has changed. "static" in a global scope in a plugin would more or less be useless and its the exact same thing as declaring it in the global scope, only declaring it gives it a default value. And what hmmmmm said.


All times are GMT -4. The time now is 17:10.

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