Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CLuaAuto : public lua::Interface
- {
- public:
- void Initialize(lua::Interface* pLuaInterface)
- {
- assert(pLuaInterface && "NULL Lua Interface");
- self = pLuaInterface;
- }
- void GetField(int iStackPos, const char* strName)
- {
- assert(self && "NULL Lua Interface");
- typedef void(__thiscall * PushNilFn)(Interface*, int, const char*);
- method<PushNilFn>(4, self)(self, iStackPos, strName);
- m_LuaStack++;
- }
- void PushNil()
- {
- assert(self && "NULL Lua Interface");
- typedef void(__thiscall * PushNilFn)(Interface*);
- method<PushNilFn>(28, self)(self);
- m_LuaStack++;
- }
- void PushString(const char* val, unsigned int iLen = 0)
- {
- assert(self && "NULL Lua Interface");
- typedef void(__thiscall * PushStringFn)(Interface*, const char*, unsigned int);
- method<PushStringFn>(29, self)(self, val, iLen);
- m_LuaStack++;
- }
- void PushNumber(double val)
- {
- assert(self && "NULL Lua Interface");
- typedef void(__thiscall * PushNumberFn)(Interface*, double);
- method<PushNumberFn>(30, self)(self, val);
- m_LuaStack++;
- }
- void PushBool(bool val)
- {
- assert(self && "NULL Lua Interface");
- typedef void(__thiscall * PushBoolFn)(Interface*, bool);
- method<PushBoolFn>(31, self)(self, val);
- m_LuaStack++;
- }
- void PushCFunction()
- {
- assert(self && "NULL Lua Interface");
- typedef void(__thiscall * PushBoolFn)(Interface*);
- method<PushBoolFn>(32, self)(self);
- m_LuaStack++;
- }
- void PushCClosure()
- {
- assert(self && "NULL Lua Interface");
- typedef void(__thiscall * PushBoolFn)(Interface*);
- method<PushBoolFn>(33, self)(self);
- m_LuaStack++;
- }
- void PushUserdata(void* data)
- {
- assert(self && "NULL Lua Interface");
- typedef void(__thiscall * PushBoolFn)(Interface*, void*);
- method<PushBoolFn>(34, self)(self, data);
- m_LuaStack++;
- }
- void PushSpecial(lua::special iType)
- {
- assert(self && "NULL Lua Interface");
- typedef void(__thiscall * PushBoolFn)(Interface*, lua::special);
- method<PushBoolFn>(38, self)(self, iType);
- m_LuaStack++;
- }
- void PushAngle(const Vector& angle)
- {
- assert(self && "NULL Lua Interface");
- typedef void(__thiscall * PushAngleFn)(Interface*, const Vector&);
- method<PushAngleFn>(48, self)(self, angle);
- m_LuaStack++;
- }
- void PushVector(const Vector& vec)
- {
- assert(self && "NULL Lua Interface");
- typedef void(__thiscall * PushVectorFn)(Interface*, const Vector&);
- method<PushVectorFn>(49, self)(self, vec);
- m_LuaStack++;
- }
- void PopStack(int iAmt = 1, bool bPopLocal = true)
- {
- self->Pop(iAmt);
- if (bPopLocal) {
- assert(m_LuaStack <= 0 && "Nothing to Pop");
- m_LuaStack--;
- }
- }
- void AutoPop()
- {
- PopStack(m_LuaStack);
- }
- private:
- lua::Interface* self;
- int m_LuaStack;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement