Skip to content

Commit

Permalink
Added version specific global variable to avoid addon conflicts. Edit…
Browse files Browse the repository at this point in the history
…ed README
  • Loading branch information
Winded committed Apr 5, 2015
1 parent 1c873b8 commit 598be23
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,7 @@ Custom types can be registered with _BiValues.RegisterBindType_. There are some
- **Remove()** - Called when the binding is removed (unbound). You should remove your callback hooks here
- **SetValue(value)** - Called when the value is changed from elsewhere than the binding itself. You should handle applying the value change to your bound entity/element here

You can better understand how bindings work by looking at the default bindings.
You can better understand how bindings work by looking at the default bindings.

## Conflicting addons
It's possible that other addons a user has installed are using BiValues. This wouldn't be a problem if they used the exact same version as your addon, but they probably don't. To avoid conflicts, instead of using the _BiValues_ global variable, use _BiValuesV000_, replacing the zeroes with the version of BiValues that you are using. This way, you won't be using a different version of BiValues than you think and your code won't break.
3 changes: 2 additions & 1 deletion bivalues.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ THE SOFTWARE.
--]]

if _G["BiValues"] then return; end
local VERSION = "021";

---
-- BiValues table definition
Expand Down Expand Up @@ -737,4 +737,5 @@ end
---

AddCSLuaFile();
_G["BiValuesV" .. VERSION] = BV;
_G.BiValues = BV;

0 comments on commit 598be23

Please sign in to comment.