Files
mir_server/sdk/srvlib/include/LuaVariantClass.h
aixianling 5c9f1dae4a init
2025-01-09 17:45:40 +08:00

43 lines
1.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
/************************************************************************
基于CustomLuaClass类实现方式的CLVaraint导出类
已测试全部功能可以使用但此代码仅用作对CustomLuaClass的实现演示。
CustomLuaClass在设计思想上不够完善随可以使用但仍有不足。
***********************************************************************/
class CLuaVariantClass :
public CCustomLuaClass<CCLVariant, CLuaVariantClass>
{
public:
typedef CCustomLuaClass<CCLVariant, CLuaVariantClass> Inherited;
protected:
CCLVariant* create(lua_State *L);
void destroy(lua_State *L, CCLVariant *ptr);
int get(lua_State *L, CCLVariant *pInst);
int set(lua_State *L, CCLVariant *pInst);
int eq(lua_State *L, CCLVariant *pInst);
int add(lua_State *L, CCLVariant *pInst);
int sub(lua_State *L, CCLVariant *pInst);
int mul(lua_State *L, CCLVariant *pInst);
int div(lua_State *L, CCLVariant *pInst);
int mod(lua_State *L, CCLVariant *pInst);
int unm(lua_State *L, CCLVariant *pInst);
int len(lua_State *L, CCLVariant *pInst);
int lt(lua_State *L, CCLVariant *pInst);
int le(lua_State *L, CCLVariant *pInst);
int concat(lua_State *L, CCLVariant *pInst);
int testCall(lua_State *L, CCLVariant *pInst);
private:
void setVarFromTable(lua_State *L, CCLVariant *pVar, int vidx = -1);
void setVarMember(lua_State *L, CCLVariant *pVar, const char* sName, int vidx = -1);
private:
static const FuncCall fnList[];
public:
CLuaVariantClass();
};