Very minor channel / variant performance improvements and cleanup.

This commit is contained in:
Alex Szpakowski
2016-03-12 19:11:03 -04:00
parent a0bbcce8ee
commit d0c0240e09
6 changed files with 48 additions and 57 deletions
+16 -14
View File
@@ -35,6 +35,19 @@ class Variant
{
public:
enum Type
{
UNKNOWN = 0,
BOOLEAN,
NUMBER,
STRING,
SMALLSTRING,
LUSERDATA,
FUSERDATA,
NIL,
TABLE
};
Variant();
Variant(bool boolean);
Variant(double number);
@@ -48,7 +61,9 @@ public:
Variant &operator = (const Variant &v);
static bool fromLua(lua_State *L, int n, Variant *v, bool allowTables = true);
Type getType() const { return type; }
static Variant fromLua(lua_State *L, int n, bool allowTables = true);
void toLua(lua_State *L) const;
private:
@@ -83,19 +98,6 @@ private:
std::vector<std::pair<Variant, Variant>> *table;
};
enum Type
{
UNKNOWN = 0,
BOOLEAN,
NUMBER,
STRING,
SMALLSTRING,
LUSERDATA,
FUSERDATA,
NIL,
TABLE
};
static const int MAX_SMALL_STRING_LENGTH = 15;
Type type;