CHANGED: #1471 Moved the stuff I moved to NELGUI library, under the NLGUI namespace.

--HG--
branch : gui-refactoring
hg/feature/sse2
dfighter1985 13 years ago
parent 5a2a89b4fc
commit f769f6fb0c

@ -19,8 +19,9 @@
#include "nel/misc/types_nl.h"
#include "nel/gui/lua_helper.h"
using namespace NLGUI;
#define IHM_LUA_METATABLE "__ui_metatable"
#define IHM_LUA_ENVTABLE "__ui_envtable"
namespace NLMISC
{
@ -29,20 +30,23 @@ namespace NLMISC
class CRGBA;
}
class CReflectable;
class CReflectedProperty;
namespace NLGUI
{
// ***************************************************************************
/* Use this Exception for all LUA Error (eg: scripted passes bad number of paramters).
class CReflectable;
class CReflectedProperty;
// ***************************************************************************
/* Use this Exception for all LUA Error (eg: scripted passes bad number of paramters).
* Does not herit from Exception because avoid nlinfo, because sent twice (catch then resent)
* This is special to lua and IHM since it works with CLuaStackChecker, and also append to the error msg
* the FileName/LineNumber
*/
class ELuaIHMException : public ELuaWrappedFunctionException
{
private:
class ELuaIHMException : public ELuaWrappedFunctionException
{
private:
static CLuaState *getLuaState();
public:
public:
ELuaIHMException() : ELuaWrappedFunctionException(getLuaState())
{
}
@ -55,24 +59,18 @@ public:
NLMISC_CONVERT_VARGS (reason, format, NLMISC::MaxCStringSize);
init(getLuaState(), reason);
}
};
// ***************************************************************************
#define IHM_LUA_METATABLE "__ui_metatable"
#define IHM_LUA_ENVTABLE "__ui_envtable"
};
// ***************************************************************************
/**
// ***************************************************************************
/**
* Define Functions to export from C to LUA
* \author Lionel Berenguier
* \author Nevrax France
* \date 2004
*/
class CLuaIHM
{
public:
class CLuaIHM
{
public:
static void registerAll(CLuaState &ls);
/** CReflectableInterfaceElement management on stack, stored by a CRefPtr.
@ -127,35 +125,27 @@ public:
private:
private:
static void registerBasics(CLuaState &ls);
static void registerIHM(CLuaState &ls);
static void createLuaEnumTable(CLuaState &ls, const std::string &str);
/// \name Exported Functions
// @{
//////////////////////////////////////////// Exported functions //////////////////////////////////////////////////////
// LUA exported Functions with luabind
static uint32 getLocalTime();
static double getPreciseLocalTime();
static std::string findReplaceAll(const std::string &str, const std::string &search, const std::string &replace);
static ucstring findReplaceAll(const ucstring &str, const ucstring &search, const ucstring &replace);
// just for ease of use
static ucstring findReplaceAll(const ucstring &str, const std::string &search, const std::string &replace);
static ucstring findReplaceAll(const ucstring &str, const std::string &search, const ucstring &replace);
static ucstring findReplaceAll(const ucstring &str, const ucstring &search, const std::string &replace);
// @}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Function export tools
// Function to forward lua call to C++ to a 'lua method' exported from a reflected object
static int luaMethodCall(lua_State *ls);
};
};
}
#endif // NL_LUA_IHM_H

@ -22,12 +22,11 @@
namespace NLGUI
{
class CLuaState;
}
/// Provides a single global access point to the Lua state, and related stuff. :(
class CLuaManager
{
public:
/// Provides a single global access point to the Lua state, and related stuff. :(
class CLuaManager
{
public:
~CLuaManager();
static CLuaManager& getInstance()
@ -44,14 +43,15 @@ public:
NLGUI::CLuaState* getLuaState() const{ return luaState; }
private:
private:
CLuaManager();
static CLuaManager *instance;
static bool debugLua;
NLMISC::CSmartPtr< NLGUI::CLuaState > luaState;
};
};
}
#endif

@ -20,15 +20,14 @@
#include "nel/misc/smart_ptr.h"
#include "nel/misc/rgba.h"
//
#include "nel/gui/lua_helper.h"
using namespace NLGUI;
namespace NLGUI
{
class CLuaEnumeration;
class CLuaEnumeration;
/**
/**
* Wrapper to a lua value
*
* Useful to navigate through lua tables without having to deal with the stack.
@ -48,9 +47,9 @@ class CLuaEnumeration;
*
* Each reference object has an id giving its path in order to track bugs more easily
*/
class CLuaObject
{
public:
class CLuaObject
{
public:
CLuaObject() {}
~CLuaObject();
// Build this object by popping it from the given lua state
@ -171,13 +170,13 @@ public:
bool callNoThrow(int numArgs, int numRet);
// Call a method of this table by name (no throw version)
bool callMethodByNameNoThrow(const char *name, int numArgs, int numRet);
private:
private:
NLMISC::CRefPtr<CLuaState> _LuaState;
std::string _Id;
};
};
/** enumeration of the content of a lua table
/** enumeration of the content of a lua table
*
* Example of use :
*
@ -208,9 +207,9 @@ private:
\endcode
*
*/
class CLuaEnumeration
{
public:
class CLuaEnumeration
{
public:
// is there a next key,value pair in the table
bool hasNext() { return _HasNext; }
// Return next key. Assertion if 'hasNext' is false
@ -219,7 +218,7 @@ public:
CLuaObject &nextValue();
// Go to the next value. Assertion if there's no such value
void next();
private:
private:
friend class CLuaObject;
// current value & key
CLuaObject _Table;
@ -229,63 +228,63 @@ private:
bool _HasNext;
// construction from a table on the stack
CLuaEnumeration(CLuaObject &table);
};
};
/** macro to ease lua table enumeration
/** macro to ease lua table enumeration
* \param object A CLuaObject which must be a table, and on which enumeration is done. An exception will be thrown as 'CLuaObject::enumerate' is
* called if this is not the case
* \param enumerator The enumerator object
*/
#define ENUM_LUA_TABLE(object, enumerator) for(CLuaEnumeration enumerator = (object).enumerate(); enumerator.hasNext(); enumerator.next())
#define ENUM_LUA_TABLE(object, enumerator) for(CLuaEnumeration enumerator = (object).enumerate(); enumerator.hasNext(); enumerator.next())
//opitmized lua string for fast comparison
class CLuaString
{
public:
//opitmized lua string for fast comparison
class CLuaString
{
public:
explicit CLuaString(const char *value = "")
{
nlassert( value != NULL );
_Str = value;
}
const std::string& getStr() const{ return _Str; }
private:
private:
std::string _Str;
mutable CLuaState::TRefPtr _LuaState; // ref ptr so that statics get rebuilt on lua restart
mutable CLuaObject _InLua;
};
};
inline bool operator==(const char* lh, const CLuaString& rh)
{
inline bool operator==(const char* lh, const CLuaString& rh)
{
return std::string(lh) == rh.getStr();
}
}
inline bool operator==( const CLuaString& lh, const CLuaString& rh)
{
inline bool operator==( const CLuaString& lh, const CLuaString& rh)
{
return lh.getStr() == rh.getStr();
}
}
inline bool operator==(const CLuaString& lh, const char* rh)
{
inline bool operator==(const CLuaString& lh, const char* rh)
{
return std::string(rh) == lh.getStr();
}
}
inline bool operator==( const CLuaString& lh, const std::string& rh)
{
inline bool operator==( const CLuaString& lh, const std::string& rh)
{
return lh.getStr() == rh;
}
}
inline bool operator==(const std::string& lh, const CLuaString& rh)
{
inline bool operator==(const std::string& lh, const CLuaString& rh)
{
return lh == rh.getStr();
}
}
class CLuaHashMapTraits
{
public:
class CLuaHashMapTraits
{
public:
static const size_t bucket_size = 4;
static const size_t min_buckets = 8;
CLuaHashMapTraits()
@ -296,6 +295,9 @@ public:
// equality for lua string for hash_map -> they are unique pointer -> compare pointers instead of string content
bool operator()(const char *lhs, const char *rhs) const { return lhs < rhs; }
};
};
}
#endif

@ -14,30 +14,25 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CL_REFLECT_H
#define CL_REFLECT_H
#include "nel/misc/rgba.h"
#include "nel/gui/lua_object.h"
//
#include <string>
class CReflectable;
namespace NLGUI
{
class CReflectable;
class CLuaState;
}
struct CClassInfo;
struct CClassInfo;
/** A property of a reflectable object
/** A property of a reflectable object
* NB: multiple inheritance not supported
*/
class CReflectedProperty
{
public:
class CReflectedProperty
{
public:
enum TType { Boolean = 0,
SInt32,
UInt32,
@ -66,7 +61,7 @@ public:
//
typedef int (CReflectable:: *TLuaMethod) (CLuaState &luaState);
public:
public:
TType Type;
// In each union we have method pointers to retrieve / set the data of the desired type (as told in 'Type')
union
@ -94,20 +89,20 @@ public:
std::string Name;
mutable CLuaObject LuaMethodRef; // cache pointer to function call if type == LuaMethod
const CClassInfo *ParentClass; // filled when 'registerClass' is called
};
};
// a vector of reflected properties
typedef std::vector<CReflectedProperty> TReflectedProperties;
// a vector of reflected properties
typedef std::vector<CReflectedProperty> TReflectedProperties;
struct CClassInfo;
struct CClassInfo;
/** Base class for a reflectable object
/** Base class for a reflectable object
* NB: multiple inheritance not supported
*/
class CReflectable
{
public:
class CReflectable
{
public:
virtual ~CReflectable() {}
virtual const char *getReflectedClassName() const { return "CReflectable"; }
virtual const char *getRflectedParentClassName() const { return ""; }
@ -127,17 +122,17 @@ public:
* TODO nico : optimized version for lua string (found in CLuaIHM) would maybe fit better here ...
*/
const CReflectedProperty *getReflectedProperty(const std::string &propertyName, bool dspWarning= true) const;
};
};
struct CLuaIndexedProperty
{
struct CLuaIndexedProperty
{
const CReflectedProperty *Prop;
CLuaString Id; // must keep id here, so that we are sure the string is not gc in lua and its pointer remains valid
};
};
struct CClassInfo
{
struct CClassInfo
{
TReflectedProperties Properties; // the properties exported by this class
const CClassInfo *ParentClass; // pointer to infos of the parent class, or NULL if it is a root class
std::string ClassName;
@ -145,9 +140,9 @@ struct CClassInfo
*/
typedef CHashMap<const char *, CLuaIndexedProperty, CLuaHashMapTraits> TLuaStrToPropMap;
mutable TLuaStrToPropMap LuaStrToProp;
};
};
/** Simple reflection system.
/** Simple reflection system.
* Used by the GUI and some other objects.
* It is used to export some properties so that we can easily manipulate them in the GUI scripts (either lua or with CInterfaceExpr).
* NB: multiple inheritance not supported
@ -178,13 +173,13 @@ struct CClassInfo
* \author Nevrax France
* \date 2002
*/
class CReflectSystem
{
public:
class CReflectSystem
{
public:
typedef std::map<std::string, CClassInfo> TClassMap;
public:
public:
// release memory
static void release();
@ -199,20 +194,20 @@ public:
// get the list of class for debug or read purpose (NULL if no register has been called)
static const TClassMap *getClassMap() {return _ClassMap;}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private:
static TClassMap *_ClassMap; // each class and its infos
};
};
/** Helper macros to export properties of a reflectable class
/** Helper macros to export properties of a reflectable class
*/
/** Start a declaration of a reflectable class exports
/** Start a declaration of a reflectable class exports
* Should be placed inside the class
*/
#define REFLECT_EXPORT_START(className, parentName) \
#define REFLECT_EXPORT_START(className, parentName) \
virtual const char *getReflectedClassName() const { return #className; } \
virtual const char *getReflectedParentClassName() const { return #parentName; } \
static void getReflectedProperties(TReflectedProperties &props) \
@ -236,136 +231,138 @@ private:
nlunreferenced(props);
// export a boolean value, by giving the name of the get and the set method
#define REFLECT_BOOL(exportName, getMethod, setMethod) \
{ \
// export a boolean value, by giving the name of the get and the set method
#define REFLECT_BOOL(exportName, getMethod, setMethod) \
{ \
CReflectedProperty prop; \
prop.Name = exportName; \
prop.Type = CReflectedProperty::Boolean; \
prop.GetMethod.GetBool = (CReflectedProperty::TGetBool) (TGetBoola) &A::getMethod; \
prop.SetMethod.SetBool = (CReflectedProperty::TSetBool) (TSetBoola) &A::setMethod; \
props.push_back(prop); \
}
}
// export a sint32 value, by giving the name of the get and the set method
#define REFLECT_SINT32(exportName, getMethod, setMethod) \
{ \
// export a sint32 value, by giving the name of the get and the set method
#define REFLECT_SINT32(exportName, getMethod, setMethod) \
{ \
CReflectedProperty prop; \
prop.Name = exportName; \
prop.Type = CReflectedProperty::SInt32; \
prop.GetMethod.GetSInt32 = (CReflectedProperty::TGetSInt32) (TGetSInt32a) &A::getMethod; \
prop.SetMethod.SetSInt32 = (CReflectedProperty::TSetSInt32) (TSetSInt32a) &A::setMethod; \
props.push_back(prop); \
}
}
// export a sint32 value, by giving the name of the get and the set method
#define REFLECT_UINT32(exportName, getMethod, setMethod) \
{ \
// export a sint32 value, by giving the name of the get and the set method
#define REFLECT_UINT32(exportName, getMethod, setMethod) \
{ \
CReflectedProperty prop; \
prop.Name = exportName; \
prop.Type = CReflectedProperty::UInt32; \
prop.GetMethod.GetUInt32 = (CReflectedProperty::TGetUInt32) (TGetUInt32a) &A::getMethod; \
prop.SetMethod.SetUInt32 = (CReflectedProperty::TSetUInt32) (TSetUInt32a) &A::setMethod; \
props.push_back(prop); \
}
}
// export a float value, by giving the name of the get and the set method
#define REFLECT_FLOAT(exportName, getMethod, setMethod) \
{ \
// export a float value, by giving the name of the get and the set method
#define REFLECT_FLOAT(exportName, getMethod, setMethod) \
{ \
CReflectedProperty prop; \
prop.Name = exportName; \
prop.Type = CReflectedProperty::Float; \
prop.GetMethod.GetFloat = (CReflectedProperty::TGetFloat) (TGetFloata) &A::getMethod; \
prop.SetMethod.SetFloat = (CReflectedProperty::TSetFloat) (TSetFloata) &A::setMethod; \
props.push_back(prop); \
}
}
// export a string value, by giving the name of the get and the set method
#define REFLECT_STRING(exportName, getMethod, setMethod) \
{ \
// export a string value, by giving the name of the get and the set method
#define REFLECT_STRING(exportName, getMethod, setMethod) \
{ \
CReflectedProperty prop; \
prop.Name = exportName; \
prop.Type = CReflectedProperty::String; \
prop.GetMethod.GetString = (CReflectedProperty::TGetString) (TGetStringa) &A::getMethod; \
prop.SetMethod.SetString = (CReflectedProperty::TSetString) (TSetStringa) &A::setMethod; \
props.push_back(prop); \
}
}
// export a unicode string value, by giving the name of the get and the set method
#define REFLECT_UCSTRING(exportName, getMethod, setMethod) \
{ \
// export a unicode string value, by giving the name of the get and the set method
#define REFLECT_UCSTRING(exportName, getMethod, setMethod) \
{ \
CReflectedProperty prop; \
prop.Name = exportName; \
prop.Type = CReflectedProperty::UCString; \
prop.GetMethod.GetUCString = (CReflectedProperty::TGetUCString) (TGetUCStringa) &A::getMethod; \
prop.SetMethod.SetUCString = (CReflectedProperty::TSetUCString) (TSetUCStringa) &A::setMethod; \
props.push_back(prop); \
}
}
// export a color value, by giving the name of the get and the set method
#define REFLECT_RGBA(exportName, getMethod, setMethod) \
{ \
// export a color value, by giving the name of the get and the set method
#define REFLECT_RGBA(exportName, getMethod, setMethod) \
{ \
CReflectedProperty prop; \
prop.Name = exportName; \
prop.Type = CReflectedProperty::RGBA; \
prop.GetMethod.GetRGBA = (CReflectedProperty::TGetRGBA) (TGetRGBAa) &A::getMethod; \
prop.SetMethod.SetRGBA = (CReflectedProperty::TSetRGBA) (TSetRGBAa) &A::setMethod; \
props.push_back(prop); \
}
}
// export a lua method
#define REFLECT_LUA_METHOD(exportName, method) \
{ \
// export a lua method
#define REFLECT_LUA_METHOD(exportName, method) \
{ \
CReflectedProperty prop; \
prop.Name = exportName; \
prop.Type = CReflectedProperty::LuaMethod; \
prop.GetMethod.GetLuaMethod = (CReflectedProperty::TLuaMethod) (TLuaMethoda) &A::method; \
props.push_back(prop); \
}
}
// ends an export declaration
#define REFLECT_EXPORT_END }
// ends an export declaration
#define REFLECT_EXPORT_END }
// This macro registers a reflectable class to the manager
#define REGISTER_REFLECTABLE_CLASS(className, parentName) \
{ \
// This macro registers a reflectable class to the manager
#define REGISTER_REFLECTABLE_CLASS(className, parentName) \
{ \
TReflectedProperties props; \
className::getReflectedProperties(props); \
CReflectSystem::registerClass(#className, #parentName, props); \
}
}
/** Reflectable refcounted object
/** Reflectable refcounted object
* NB nico : added this intermediate class so that the binding from lua to the reflection
* system that are found in CLuaIHM can be reused for other objects as well
* NOTE: The class is named 'CReflectableRefPtrTarget' and not 'CReflectableRefCount'
* because the refcount part is only used for ref pointing in the ui
*/
class CReflectableRefPtrTarget : public CReflectable, public NLMISC::CRefCount
{
public:
class CReflectableRefPtrTarget : public CReflectable, public NLMISC::CRefCount
{
public:
virtual ~CReflectableRefPtrTarget();
};
};
class CReflectableLuaRef
{
public:
class CReflectableLuaRef
{
public:
CReflectableLuaRef(CReflectableRefPtrTarget *ptr = NULL) : Ptr(ptr), _ClassInfo(NULL) {}
NLMISC::CRefPtr<CReflectableRefPtrTarget> Ptr;
const CClassInfo &getClassInfo() const;
// IMPORTANT : luaStringPtr should have been obtained from lua, see remark in CClassInfo
const CReflectedProperty *getProp(const char *luaStringPtr) const;
private:
private:
// cache to class definition of the pointee object (once a CReflectableLuaRef created in lua, it remains a *const* pointer)
mutable const CClassInfo *_ClassInfo;
};
};
}
#endif

@ -16,7 +16,6 @@
#include "nel/gui/lua_helper.h"
using namespace NLGUI;
#include <algorithm>
@ -92,8 +91,11 @@ std::ostream &operator<<(std::ostream &str, const ucstring &value)
return str << value.toString();
}
struct CMiscFunctions
namespace NLGUI
{
struct CMiscFunctions
{
static std::string fileLookup(const std::string &fileName)
{
return NLMISC::CPath::lookup(fileName, false);
@ -106,23 +108,23 @@ struct CMiscFunctions
#endif
#endif
}
};
};
// ***************************************************************************
bool CLuaIHM::pop(CLuaState &ls, NLMISC::CRGBA &dest)
{
// ***************************************************************************
bool CLuaIHM::pop(CLuaState &ls, NLMISC::CRGBA &dest)
{
//H_AUTO(Lua_CLuaIHM_pop)
try
{
if (ls.isNil(-1)) return false;
#if LUABIND_VERSION > 600
#if LUABIND_VERSION > 600
luabind::object obj(luabind::from_stack(ls.getStatePointer(), -1));
ls.pop();
#else
#else
luabind::object obj(ls.getStatePointer());
obj.set();
#endif
#endif
dest = luabind::object_cast<NLMISC::CRGBA>(obj);
}
catch(const luabind::cast_failed &)
@ -130,22 +132,22 @@ bool CLuaIHM::pop(CLuaState &ls, NLMISC::CRGBA &dest)
return false;
}
return true;
}
}
// ***************************************************************************
bool CLuaIHM::pop(CLuaState &ls,NLMISC::CVector2f &dest)
{
// ***************************************************************************
bool CLuaIHM::pop(CLuaState &ls,NLMISC::CVector2f &dest)
{
//H_AUTO(Lua_CLuaIHM_pop)
try
{
if (ls.isNil(-1)) return false;
#if LUABIND_VERSION > 600
#if LUABIND_VERSION > 600
luabind::object obj(luabind::from_stack(ls.getStatePointer(), -1));
ls.pop();
#else
#else
luabind::object obj(ls.getStatePointer());
obj.set();
#endif
#endif
dest = luabind::object_cast<NLMISC::CVector2f>(obj);
}
catch(const luabind::cast_failed &)
@ -153,22 +155,22 @@ bool CLuaIHM::pop(CLuaState &ls,NLMISC::CVector2f &dest)
return false;
}
return true;
}
}
// ***************************************************************************
bool CLuaIHM::pop(CLuaState &ls, ucstring &dest)
{
// ***************************************************************************
bool CLuaIHM::pop(CLuaState &ls, ucstring &dest)
{
//H_AUTO(Lua_CLuaIHM_pop)
try
{
if (ls.isNil(-1)) return false;
#if LUABIND_VERSION > 600
#if LUABIND_VERSION > 600
luabind::object obj(luabind::from_stack(ls.getStatePointer(), -1));
ls.pop();
#else
#else
luabind::object obj(ls.getStatePointer());
obj.set();
#endif
#endif
dest = luabind::object_cast<ucstring>(obj);
}
catch(const luabind::cast_failed &)
@ -176,69 +178,71 @@ bool CLuaIHM::pop(CLuaState &ls, ucstring &dest)
return false;
}
return true;
}
}
// ***************************************************************************
bool CLuaIHM::isUCStringOnStack(CLuaState &ls, sint index)
{
// ***************************************************************************
bool CLuaIHM::isUCStringOnStack(CLuaState &ls, sint index)
{
//H_AUTO(Lua_CLuaIHM_isUCStringOnStack)
ls.pushValue(index);
ucstring dummy;
return pop(ls, dummy);
}
}
// ***************************************************************************
bool CLuaIHM::getUCStringOnStack(CLuaState &ls, sint index, ucstring &dest)
{
// ***************************************************************************
bool CLuaIHM::getUCStringOnStack(CLuaState &ls, sint index, ucstring &dest)
{
//H_AUTO(Lua_CLuaIHM_getUCStringOnStack)
ls.pushValue(index);
return pop(ls, dest);
}
}
// ***************************************************************************
void CLuaIHM::push(CLuaState &ls, const ucstring &value)
{
// ***************************************************************************
void CLuaIHM::push(CLuaState &ls, const ucstring &value)
{
//H_AUTO(Lua_CLuaIHM_push)
#if LUABIND_VERSION > 600
#if LUABIND_VERSION > 600
luabind::detail::push(ls.getStatePointer(), value);
#else
#else
luabind::object obj(ls.getStatePointer(), value);
obj.pushvalue();
#endif
}
#endif
}
// ***************************************************************************
// ***************************************************************************
// CInterface To LUA Registry
// ***************************************************************************
// ***************************************************************************
// ***************************************************************************
// ***************************************************************************
// CInterface To LUA Registry
// ***************************************************************************
// ***************************************************************************
CLuaState * ELuaIHMException::getLuaState()
{
CLuaState * ELuaIHMException::getLuaState()
{
return CLuaManager::getInstance().getLuaState();
}
}
// ***************************************************************************
#define LUA_REGISTER_BASIC(_type_) \
luabind::detail::yes_t is_user_defined(luabind::detail::by_value<_type_>); \
_type_ convert_lua_to_cpp(lua_State* L, luabind::detail::by_value<_type_>, int index) \
{ \
// ***************************************************************************
#define LUA_REGISTER_BASIC(_type_) \
luabind::detail::yes_t is_user_defined(luabind::detail::by_value<_type_>); \
_type_ convert_lua_to_cpp(lua_State* L, luabind::detail::by_value<_type_>, int index) \
{ \
return (_type_)lua_tonumber(L, index); \
} \
int match_lua_to_cpp(lua_State* L, luabind::detail::by_value<_type_>, int index) \
{ \
} \
int match_lua_to_cpp(lua_State* L, luabind::detail::by_value<_type_>, int index) \
{ \
if (lua_isnumber(L, index)) return 0; else return -1; \
} \
void convert_cpp_to_lua(lua_State* L, const _type_& v) \
{ \
} \
void convert_cpp_to_lua(lua_State* L, const _type_& v) \
{ \
lua_pushnumber(L, (double)v); \
}
}
// Basic LUA types
namespace luabind
{
// Basic LUA types
namespace luabind
{
namespace converters
{
LUA_REGISTER_BASIC(sint8)
@ -247,14 +251,17 @@ namespace luabind
LUA_REGISTER_BASIC(uint16)
LUA_REGISTER_BASIC(sint32)
LUA_REGISTER_BASIC(uint32)
// LUA_REGISTER_BASIC(sint)
// LUA_REGISTER_BASIC(uint)
// LUA_REGISTER_BASIC(sint)
// LUA_REGISTER_BASIC(uint)
}
}
}
// ***************************************************************************
void CLuaIHM::registerBasics(CLuaState &ls)
namespace NLGUI
{
// ***************************************************************************
void CLuaIHM::registerBasics(CLuaState &ls)
{
//H_AUTO(Lua_CLuaIHM_registerBasics)
using namespace luabind;
lua_State *L= ls.getStatePointer();
@ -283,7 +290,7 @@ void CLuaIHM::registerBasics(CLuaState &ls)
.def(const_self + other<const std::string>())
.def(other<const std::string>() + const_self)
// NB nico : luabind crash not solved here -> use concatUCString as a replacement
// .def(const_self + other<const ucstring &>())
// .def(const_self + other<const ucstring &>())
.def(const_self < other<const ucstring&>())
.def(const_self == other<const ucstring&>())
.def("toUtf8", &ucstring::toUtf8)
@ -303,12 +310,12 @@ void CLuaIHM::registerBasics(CLuaState &ls)
.def_readwrite("y", &NLMISC::CVector2f::y)
];
}
}
// ***************************************************************************
int CLuaIHM::luaMethodCall(lua_State *ls)
{
// ***************************************************************************
int CLuaIHM::luaMethodCall(lua_State *ls)
{
//H_AUTO(Lua_CLuaIHM_luaMethodCall)
nlassert(ls);
const CReflectedProperty *prop = (const CReflectedProperty *) lua_touserdata(ls, lua_upvalueindex(1));
@ -351,11 +358,11 @@ int CLuaIHM::luaMethodCall(lua_State *ls)
lua_error(ls);
}
return numResults;
}
}
// ***************************************************************************
void CLuaIHM::luaValueFromReflectedProperty(CLuaState &ls, CReflectable &reflectedObject, const CReflectedProperty &property)
{
// ***************************************************************************
void CLuaIHM::luaValueFromReflectedProperty(CLuaState &ls, CReflectable &reflectedObject, const CReflectedProperty &property)
{
//H_AUTO(Lua_CLuaIHM_luaValueFromReflectedProperty)
switch(property.Type)
{
@ -374,23 +381,23 @@ void CLuaIHM::luaValueFromReflectedProperty(CLuaState &ls, CReflectable &reflect
case CReflectedProperty::UCString:
{
ucstring str = (reflectedObject.*(property.GetMethod.GetUCString))();
#if LUABIND_VERSION > 600
#if LUABIND_VERSION > 600
luabind::detail::push(ls.getStatePointer(), str);
#else
#else
luabind::object obj(ls.getStatePointer(), str);
obj.pushvalue();
#endif
#endif
}
break;
case CReflectedProperty::RGBA:
{
CRGBA color = (reflectedObject.*(property.GetMethod.GetRGBA))();
#if LUABIND_VERSION > 600
#if LUABIND_VERSION > 600
luabind::detail::push(ls.getStatePointer(), color);
#else
#else
luabind::object obj(ls.getStatePointer(), color);
obj.pushvalue();
#endif
#endif
}
break;
case CReflectedProperty::LuaMethod:
@ -411,14 +418,14 @@ void CLuaIHM::luaValueFromReflectedProperty(CLuaState &ls, CReflectable &reflect
nlstop;
break;
}
}
}
static CLuaString lstr_Env("Env");
static CLuaString lstr_isNil("isNil");
static CLuaString lstr_Env("Env");
static CLuaString lstr_isNil("isNil");
// ***************************************************************************
void CLuaIHM::luaValueToReflectedProperty(CLuaState &ls, int stackIndex, CReflectable &target, const CReflectedProperty &property) throw(ELuaIHMException)
{
// ***************************************************************************
void CLuaIHM::luaValueToReflectedProperty(CLuaState &ls, int stackIndex, CReflectable &target, const CReflectedProperty &property) throw(ELuaIHMException)
{
//H_AUTO(Lua_property_throw)
if(ls.isNil(stackIndex))
throw ELuaIHMException("Trying to set nil to UI property '%s'", property.Name.c_str());
@ -492,12 +499,12 @@ void CLuaIHM::luaValueToReflectedProperty(CLuaState &ls, int stackIndex, CReflec
default:
nlstop;
}
}
}
// ***************************************************************************
void CLuaIHM::createLuaEnumTable(CLuaState &ls, const std::string &str)
{
// ***************************************************************************
void CLuaIHM::createLuaEnumTable(CLuaState &ls, const std::string &str)
{
//H_AUTO(Lua_CLuaIHM_createLuaEnumTable)
std::string path = "", script, p;
CSString s = str;
@ -513,9 +520,9 @@ void CLuaIHM::createLuaEnumTable(CLuaState &ls, const std::string &str)
ls.executeScript(script);
p = s.splitTo('.', true);
}
}
}
#define LUABIND_ENUM(__enum__, __name__, __num__, __toStringFunc__) \
#define LUABIND_ENUM(__enum__, __name__, __num__, __toStringFunc__) \
createLuaEnumTable(ls, __name__); \
for (uint e=0 ; e<__num__ ; e++) \
{ \
@ -524,11 +531,11 @@ void CLuaIHM::createLuaEnumTable(CLuaState &ls, const std::string &str)
ls.executeScript(temp); \
} \
// ***************************************************************************
#define LUABIND_FUNC(__func__) luabind::def(#__func__, &__func__)
// ***************************************************************************
#define LUABIND_FUNC(__func__) luabind::def(#__func__, &__func__)
void CLuaIHM::registerIHM(CLuaState &ls)
{
void CLuaIHM::registerIHM(CLuaState &ls)
{
//H_AUTO(Lua_CLuaIHM_registerIHM)
CLuaStackChecker lsc(&ls);
@ -581,33 +588,33 @@ void CLuaIHM::registerIHM(CLuaState &ls)
luabind::def("getLocalTime", getLocalTime) // NB : use CLuaIHM::getLocalTime instead of NLMISC::CTime::getLocalTime, because the NLMISC
// version returns a uint64, which can't be casted into lua numbers (doubles ...)
];
}
}
// ***************************************************************************
double CLuaIHM::getPreciseLocalTime()
{
// ***************************************************************************
double CLuaIHM::getPreciseLocalTime()
{
//H_AUTO(Lua_CLuaIHM_getPreciseLocalTime)
// don't export these 2 function to lua directly here, because all uint64 can't be represented with lua 'numbers'
return NLMISC::CTime::ticksToSecond(NLMISC::CTime::getPerformanceTime());
}
}
// ***************************************************************************
void CLuaIHM::registerAll(CLuaState &ls)
{
// ***************************************************************************
void CLuaIHM::registerAll(CLuaState &ls)
{
//H_AUTO(Lua_CLuaIHM_registerAll)
registerBasics(ls);
registerIHM(ls);
}
}
//#define CHECK_REFLECTABLE_MT
//#define CHECK_REFLECTABLE_MT
// ***************************************************************************
void CLuaIHM::pushReflectableOnStack(CLuaState &ls, class CReflectableRefPtrTarget *pRPT)
{
// ***************************************************************************
void CLuaIHM::pushReflectableOnStack(CLuaState &ls, class CReflectableRefPtrTarget *pRPT)
{
//H_AUTO(Lua_CLuaIHM_pushReflectableOnStack)
nlassert(pRPT);
CLuaStackChecker lsc(&ls, 1);
@ -653,7 +660,7 @@ void CLuaIHM::pushReflectableOnStack(CLuaState &ls, class CReflectableRefPtrTa
}
// Check that the metatable is correct
#ifdef CHECK_REFLECTABLE_MT
#ifdef CHECK_REFLECTABLE_MT
nlverify(ls.getMetaTable(-1)); // userdata __ui_metatable
ls.push("__index");
ls.getTable(-2);
@ -665,13 +672,13 @@ void CLuaIHM::pushReflectableOnStack(CLuaState &ls, class CReflectableRefPtrTa
nlassert(ls.isCFunction(-2));
nlassert(ls.isCFunction(-3));
ls.pop(4);
#endif
#endif
//ls.dumpStack();
}
}
// ***************************************************************************
bool CLuaIHM::isReflectableOnStack(CLuaState &ls, sint index)
{
// ***************************************************************************
bool CLuaIHM::isReflectableOnStack(CLuaState &ls, sint index)
{
//H_AUTO(Lua_CLuaIHM_isReflectableOnStack)
CLuaStackChecker lsc(&ls);
@ -690,11 +697,11 @@ bool CLuaIHM::isReflectableOnStack(CLuaState &ls, sint index)
ls.pop();
return ok;
}
}
// ***************************************************************************
CReflectableRefPtrTarget *CLuaIHM::getReflectableOnStack(CLuaState &ls, sint index)
{
// ***************************************************************************
CReflectableRefPtrTarget *CLuaIHM::getReflectableOnStack(CLuaState &ls, sint index)
{
//H_AUTO(Lua_CLuaIHM_getReflectableOnStack)
if(!isReflectableOnStack(ls, index))
return NULL;
@ -702,67 +709,67 @@ CReflectableRefPtrTarget *CLuaIHM::getReflectableOnStack(CLuaState &ls, sint
CReflectableLuaRef *p= (CReflectableLuaRef *) ls.toUserData(index);
nlassert(p->Ptr);
return p->Ptr;
}
}
// ***************************************************************************
// ***************************************************************************
// LUA IHM Functions
// ***************************************************************************
// ***************************************************************************
// ***************************************************************************
// ***************************************************************************
// LUA IHM Functions
// ***************************************************************************
// ***************************************************************************
// ***************************************************************************
uint32 CLuaIHM::getLocalTime()
{
// ***************************************************************************
uint32 CLuaIHM::getLocalTime()
{
//H_AUTO(Lua_CLuaIHM_getLocalTime)
return (uint32) NLMISC::CTime::getLocalTime();
}
}
// ***************************************************************************
std::string CLuaIHM::findReplaceAll(const std::string &str, const std::string &search, const std::string &replace)
{
// ***************************************************************************
std::string CLuaIHM::findReplaceAll(const std::string &str, const std::string &search, const std::string &replace)
{
//H_AUTO(Lua_CLuaIHM_findReplaceAll)
std::string ret= str;
while(strFindReplace(ret, search, replace));
return ret;
}
}
// ***************************************************************************
ucstring CLuaIHM::findReplaceAll(const ucstring &str, const ucstring &search, const ucstring &replace)
{
// ***************************************************************************
ucstring CLuaIHM::findReplaceAll(const ucstring &str, const ucstring &search, const ucstring &replace)
{
//H_AUTO(Lua_CLuaIHM_findReplaceAll)
ucstring ret= str;
while(strFindReplace(ret, search, replace));
return ret;
}
}
// ***************************************************************************
ucstring CLuaIHM::findReplaceAll(const ucstring &str, const std::string &search, const std::string &replace)
{
// ***************************************************************************
ucstring CLuaIHM::findReplaceAll(const ucstring &str, const std::string &search, const std::string &replace)
{
//H_AUTO(Lua_CLuaIHM_findReplaceAll)
return findReplaceAll(str, ucstring(search), ucstring(replace));
}
}
// ***************************************************************************
ucstring CLuaIHM::findReplaceAll(const ucstring &str, const std::string &search, const ucstring &replace)
{
// ***************************************************************************
ucstring CLuaIHM::findReplaceAll(const ucstring &str, const std::string &search, const ucstring &replace)
{
//H_AUTO(Lua_CLuaIHM_findReplaceAll)
return findReplaceAll(str, ucstring(search), ucstring(replace));
}
}
// ***************************************************************************
ucstring CLuaIHM::findReplaceAll(const ucstring &str, const ucstring &search, const std::string &replace)
{
// ***************************************************************************
ucstring CLuaIHM::findReplaceAll(const ucstring &str, const ucstring &search, const std::string &replace)
{
//H_AUTO(Lua_CLuaIHM_findReplaceAll)
return findReplaceAll(str, ucstring(search), ucstring(replace));
}
}
// ***************************************************************************
void CLuaIHM::fails(CLuaState &ls, const char *format, ...)
{
// ***************************************************************************
void CLuaIHM::fails(CLuaState &ls, const char *format, ...)
{
//H_AUTO(Lua_CLuaIHM_fails)
std::string reason;
NLMISC_CONVERT_VARGS (reason, format, NLMISC::MaxCStringSize);
@ -770,52 +777,52 @@ void CLuaIHM::fails(CLuaState &ls, const char *format, ...)
ls.getStackAsString(stack);
// use a std::exception, to avoid Nel Exception warning
throw ELuaIHMException("%s. Lua stack = \n %s", reason.c_str(), stack.c_str());
}
}
// ***************************************************************************
void CLuaIHM::checkArgCount(CLuaState &ls, const char* funcName, uint nArgs)
{
// ***************************************************************************
void CLuaIHM::checkArgCount(CLuaState &ls, const char* funcName, uint nArgs)
{
//H_AUTO(Lua_CLuaIHM_checkArgCount)
if(ls.getTop()!=(sint)nArgs)
{
fails(ls, "%s() need exactly %d arguments (tips : check between method & function call)", funcName, nArgs);
}
}
}
// ***************************************************************************
void CLuaIHM::checkArgMin(CLuaState &ls, const char* funcName, uint nArgs)
{
// ***************************************************************************
void CLuaIHM::checkArgMin(CLuaState &ls, const char* funcName, uint nArgs)
{
//H_AUTO(Lua_CLuaIHM_checkArgMin)
if(ls.getTop()<(sint)nArgs)
{
fails(ls, "%s() need at least %d arguments (tips : check between method & function call)", funcName, nArgs);
}
}
}
// ***************************************************************************
void CLuaIHM::checkArgMax(CLuaState &ls,const char* funcName,uint nArgs)
{
// ***************************************************************************
void CLuaIHM::checkArgMax(CLuaState &ls,const char* funcName,uint nArgs)
{
//H_AUTO(Lua_CLuaIHM_checkArgMax)
if(ls.getTop()>(sint)nArgs)
{
fails(ls, "%s() need at most %d arguments.", funcName, nArgs);
}
}
}
// ***************************************************************************
void CLuaIHM::check(CLuaState &ls, bool ok, const std::string &failReason)
{
// ***************************************************************************
void CLuaIHM::check(CLuaState &ls, bool ok, const std::string &failReason)
{
//H_AUTO(Lua_CLuaIHM_check)
if(!ok)
{
fails(ls, failReason.c_str());
}
}
}
// ***************************************************************************
void CLuaIHM::checkArgType(CLuaState &ls, const char *funcName, uint index, int argType)
{
// ***************************************************************************
void CLuaIHM::checkArgType(CLuaState &ls, const char *funcName, uint index, int argType)
{
//H_AUTO(Lua_CLuaIHM_checkArgType)
nlassert(index > 0);
if (ls.getTop() < (int) index)
@ -826,11 +833,11 @@ void CLuaIHM::checkArgType(CLuaState &ls, const char *funcName, uint index,
{
fails(ls, "%s : argument %d of expected type %s has bad type : %s", funcName, index, ls.getTypename(argType), ls.getTypename(ls.type(index)), ls.type(index));
}
}
}
// ***************************************************************************
void CLuaIHM::checkArgTypeRGBA(CLuaState &ls, const char *funcName, uint index)
{
// ***************************************************************************
void CLuaIHM::checkArgTypeRGBA(CLuaState &ls, const char *funcName, uint index)
{
//H_AUTO(Lua_CLuaIHM_checkArgTypeRGBA)
nlassert(index > 0);
if (ls.getTop() < (int) index)
@ -843,11 +850,11 @@ void CLuaIHM::checkArgTypeRGBA(CLuaState &ls, const char *funcName, uint index)
{
fails(ls, "%s : argument %d of expected type RGBA has bad type : %s", funcName, index, ls.getTypename(ls.type(index)), ls.type(index));
}
}
}
// ***************************************************************************
void CLuaIHM::checkArgTypeUCString(CLuaState &ls, const char *funcName, uint index)
{
// ***************************************************************************
void CLuaIHM::checkArgTypeUCString(CLuaState &ls, const char *funcName, uint index)
{
//H_AUTO(Lua_CLuaIHM_checkArgTypeUCString)
nlassert(index > 0);
if (ls.getTop() < (int) index)
@ -860,23 +867,23 @@ void CLuaIHM::checkArgTypeUCString(CLuaState &ls, const char *funcName, uint ind
{
fails(ls, "%s : argument %d of expected type ucstring has bad type : %s", funcName, index, ls.getTypename(ls.type(index)), ls.type(index));
}
}
}
// ***************************************************************************
bool CLuaIHM::popString(CLuaState &ls, std::string & dest)
{
// ***************************************************************************
bool CLuaIHM::popString(CLuaState &ls, std::string & dest)
{
//H_AUTO(Lua_CLuaIHM_popString)
try
{
#if LUABIND_VERSION > 600
#if LUABIND_VERSION > 600
luabind::object obj(luabind::from_stack(ls.getStatePointer(), -1));
ls.pop();
#else
#else
luabind::object obj(ls.getStatePointer());
obj.set();
#endif
#endif
dest = luabind::object_cast<std::string>(obj);
}
catch(const luabind::cast_failed &)
@ -884,21 +891,21 @@ bool CLuaIHM::popString(CLuaState &ls, std::string & dest)
return false;
}
return true;
}
}
// ***************************************************************************
bool CLuaIHM::popSINT32(CLuaState &ls, sint32 & dest)
{
// ***************************************************************************
bool CLuaIHM::popSINT32(CLuaState &ls, sint32 & dest)
{
//H_AUTO(Lua_CLuaIHM_popSINT32)
try
{
#if LUABIND_VERSION > 600
#if LUABIND_VERSION > 600
luabind::object obj(luabind::from_stack(ls.getStatePointer(), -1));
ls.pop();
#else
#else
luabind::object obj(ls.getStatePointer());
obj.set();
#endif
#endif
dest = luabind::object_cast<sint32>(obj);
}
catch(const luabind::cast_failed &)
@ -906,11 +913,11 @@ bool CLuaIHM::popSINT32(CLuaState &ls, sint32 & dest)
return false;
}
return true;
}
}
// ***************************************************************************
void CLuaIHM::getPoly2DOnStack(CLuaState &ls, sint index, NLMISC::CPolygon2D &dest)
{
// ***************************************************************************
void CLuaIHM::getPoly2DOnStack(CLuaState &ls, sint index, NLMISC::CPolygon2D &dest)
{
//H_AUTO(Lua_CLuaIHM_getPoly2DOnStack)
ls.pushValue(index);
CLuaObject poly;
@ -926,6 +933,6 @@ void CLuaIHM::getPoly2DOnStack(CLuaState &ls, sint index, NLMISC::CPolygon2D &de
}
dest.Vertices.push_back(pos);
}
}
}
}

@ -18,17 +18,22 @@
#include "nel/gui/lua_manager.h"
#include "nel/gui/lua_helper.h"
bool CLuaManager::debugLua = false;
CLuaManager* CLuaManager::instance = NULL;
CLuaManager::CLuaManager()
namespace NLGUI
{
bool CLuaManager::debugLua = false;
CLuaManager* CLuaManager::instance = NULL;
CLuaManager::CLuaManager()
{
luaState = new NLGUI::CLuaState( debugLua );
}
}
CLuaManager::~CLuaManager()
{
CLuaManager::~CLuaManager()
{
luaState = NULL;
}
}
}

@ -14,47 +14,41 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//#include "stdpch.h"
#include "nel/gui/lua_object.h"
#include "nel/gui/lua_ihm.h"
//#include "lua_ihm_ryzom.h"
#include "nel/gui/lua_helper.h"
using namespace NLGUI;
//
//#include "interface_manager.h"
////////////////
// CLuaObject //
////////////////
// *************************************************
CLuaObject::CLuaObject(CLuaState &state, const char *id)
namespace NLGUI
{
// *************************************************
CLuaObject::CLuaObject(CLuaState &state, const char *id)
{
pop(state, id);
}
}
// *************************************************
CLuaObject::CLuaObject(CLuaState &state, const std::string &id)
{
// *************************************************
CLuaObject::CLuaObject(CLuaState &state, const std::string &id)
{
pop(state, id.c_str());
}
}
// *************************************************
bool CLuaObject::isValid() const
{
// *************************************************
bool CLuaObject::isValid() const
{
return getLuaState() != NULL;
}
}
// *************************************************
CLuaState *CLuaObject::getLuaState() const
{
// *************************************************
CLuaState *CLuaObject::getLuaState() const
{
return _LuaState;
}
}
// *************************************************
CLuaObject::CLuaObject(const CLuaObject &other)
{
// *************************************************
CLuaObject::CLuaObject(const CLuaObject &other)
{
if (other.isValid())
{
other.push();
@ -63,11 +57,11 @@ CLuaObject::CLuaObject(const CLuaObject &other)
_Id = other._Id;
}
// else ... copy of an invalid CLuaObject( is an invalid CLuaObject
}
}
// *************************************************
CLuaObject &CLuaObject::operator=(const CLuaObject &other)
{
// *************************************************
CLuaObject &CLuaObject::operator=(const CLuaObject &other)
{
if (!other.isValid())
{
release();
@ -77,28 +71,28 @@ CLuaObject &CLuaObject::operator=(const CLuaObject &other)
pop(*other.getLuaState());
_Id = other._Id;
return *this;
}
}
// *************************************************
bool CLuaObject::rawEqual(const CLuaObject &other) const
{
// *************************************************
bool CLuaObject::rawEqual(const CLuaObject &other) const
{
nlassert(other.getLuaState() == getLuaState());
push();
other.push();
bool equal = other.getLuaState()->rawEqual(-1, -2);
getLuaState()->pop(2);
return equal;
}
}
// *************************************************
CLuaObject::~CLuaObject()
{
// *************************************************
CLuaObject::~CLuaObject()
{
release();
}
}
// *************************************************
void CLuaObject::release()
{
// *************************************************
void CLuaObject::release()
{
if (_LuaState)
{
CLuaStackChecker lsc(_LuaState);
@ -107,11 +101,11 @@ void CLuaObject::release()
_LuaState->setTable(LUA_REGISTRYINDEX);
_LuaState = NULL;
}
}
}
// *************************************************
void CLuaObject::pop(CLuaState &luaState, const char *id)
{
// *************************************************
void CLuaObject::pop(CLuaState &luaState, const char *id)
{
release();
nlassert(luaState.getTop() >= 1);
{
@ -123,68 +117,68 @@ void CLuaObject::pop(CLuaState &luaState, const char *id)
luaState.pop();
_LuaState = &luaState;
_Id = id;
}
}
// *************************************************
void CLuaObject::push() const
{
// *************************************************
void CLuaObject::push() const
{
nlassert(isValid());
_LuaState->pushLightUserData((void *) this);
_LuaState->getTable(LUA_REGISTRYINDEX);
}
}
// *************************************************
int CLuaObject::type() const
{
// *************************************************
int CLuaObject::type() const
{
push();
int type = _LuaState->type();
_LuaState->pop();
return type;
}
}
// *************************************************
const char *CLuaObject::getTypename() const
{
// *************************************************
const char *CLuaObject::getTypename() const
{
push();
const char *typeName = _LuaState->getTypename(-1);
_LuaState->pop();
return typeName;
}
}
// *************************************************
bool CLuaObject::isNil() const { push(); bool result = _LuaState->isNil(); _LuaState->pop(); return result; }
bool CLuaObject::isNumber() const { push(); bool result = _LuaState->isNumber(); _LuaState->pop(); return result; }
bool CLuaObject::isBoolean() const { push(); bool result = _LuaState->isBoolean(); _LuaState->pop(); return result; }
bool CLuaObject::isString() const { push(); bool result = _LuaState->isString(); _LuaState->pop(); return result; }
bool CLuaObject::isFunction() const { push(); bool result = _LuaState->isFunction(); _LuaState->pop(); return result; }
bool CLuaObject::isCFunction() const { push(); bool result = _LuaState->isCFunction(); _LuaState->pop(); return result; }
bool CLuaObject::isTable() const { push(); bool result = _LuaState->isTable(); _LuaState->pop(); return result; }
bool CLuaObject::isUserData() const { push(); bool result = _LuaState->isUserData(); _LuaState->pop(); return result; }
bool CLuaObject::isLightUserData() const { push(); bool result = _LuaState->isLightUserData(); _LuaState->pop(); return result; }
bool CLuaObject::isRGBA() const
{
// *************************************************
bool CLuaObject::isNil() const { push(); bool result = _LuaState->isNil(); _LuaState->pop(); return result; }
bool CLuaObject::isNumber() const { push(); bool result = _LuaState->isNumber(); _LuaState->pop(); return result; }
bool CLuaObject::isBoolean() const { push(); bool result = _LuaState->isBoolean(); _LuaState->pop(); return result; }
bool CLuaObject::isString() const { push(); bool result = _LuaState->isString(); _LuaState->pop(); return result; }
bool CLuaObject::isFunction() const { push(); bool result = _LuaState->isFunction(); _LuaState->pop(); return result; }
bool CLuaObject::isCFunction() const { push(); bool result = _LuaState->isCFunction(); _LuaState->pop(); return result; }
bool CLuaObject::isTable() const { push(); bool result = _LuaState->isTable(); _LuaState->pop(); return result; }
bool CLuaObject::isUserData() const { push(); bool result = _LuaState->isUserData(); _LuaState->pop(); return result; }
bool CLuaObject::isLightUserData() const { push(); bool result = _LuaState->isLightUserData(); _LuaState->pop(); return result; }
bool CLuaObject::isRGBA() const
{
if (!isUserData()) return false;
push();
NLMISC::CRGBA dummy;
return CLuaIHM::pop(*_LuaState, dummy);
}
}
// *************************************************
bool CLuaObject::toBoolean() const { push(); bool result = _LuaState->toBoolean(); _LuaState->pop(); return result; }
lua_Number CLuaObject::toNumber() const { push(); lua_Number result = _LuaState->toNumber(); _LuaState->pop(); return result; }
std::string CLuaObject::toString() const
{
// *************************************************
bool CLuaObject::toBoolean() const { push(); bool result = _LuaState->toBoolean(); _LuaState->pop(); return result; }
lua_Number CLuaObject::toNumber() const { push(); lua_Number result = _LuaState->toNumber(); _LuaState->pop(); return result; }
std::string CLuaObject::toString() const
{
push();
const char *str = _LuaState->toString();
std::string result = str ? str : "";
_LuaState->pop();
return result;
}
lua_CFunction CLuaObject::toCFunction() const { push(); lua_CFunction result = _LuaState->toCFunction(); _LuaState->pop(); return result; }
void *CLuaObject::toUserData() const { push(); void *result = _LuaState->toUserData(); _LuaState->pop(); return result; }
const void *CLuaObject::toPointer() const { push(); const void *result = _LuaState->toPointer(); _LuaState->pop(); return result; }
NLMISC::CRGBA CLuaObject::toRGBA() const
{
}
lua_CFunction CLuaObject::toCFunction() const { push(); lua_CFunction result = _LuaState->toCFunction(); _LuaState->pop(); return result; }
void *CLuaObject::toUserData() const { push(); void *result = _LuaState->toUserData(); _LuaState->pop(); return result; }
const void *CLuaObject::toPointer() const { push(); const void *result = _LuaState->toPointer(); _LuaState->pop(); return result; }
NLMISC::CRGBA CLuaObject::toRGBA() const
{
NLMISC::CRGBA result;
push();
if (CLuaIHM::pop(*_LuaState, result))
@ -192,18 +186,18 @@ NLMISC::CRGBA CLuaObject::toRGBA() const
return result;
}
return NLMISC::CRGBA::Black;
}
}
// *************************************************
CLuaObject::operator bool() const { return toBoolean(); }
CLuaObject::operator float() const { return (float) toNumber(); }
CLuaObject::operator double() const { return (double) toNumber(); }
CLuaObject::operator std::string() const { return toString(); }
// *************************************************
CLuaObject::operator bool() const { return toBoolean(); }
CLuaObject::operator float() const { return (float) toNumber(); }
CLuaObject::operator double() const { return (double) toNumber(); }
CLuaObject::operator std::string() const { return toString(); }
// *************************************************
bool CLuaObject::isEnumerable() const
{
// *************************************************
bool CLuaObject::isEnumerable() const
{
if (isTable()) return true;
CLuaStackRestorer lsr(_LuaState, _LuaState->getTop());
push();
@ -215,21 +209,21 @@ bool CLuaObject::isEnumerable() const
return _LuaState->isFunction();
}
return false;
}
}
// *************************************************
CLuaEnumeration CLuaObject::enumerate() throw(ELuaNotATable)
{
// *************************************************
CLuaEnumeration CLuaObject::enumerate() throw(ELuaNotATable)
{
if (!isEnumerable())
{
throw ELuaNotATable(NLMISC::toString("Called CLuaObject::enumerate on an object that has no enumeration (not a table or no '__next' method in the metatable). Object is '%s' with type '%s'", getId().c_str(), getTypename()).c_str());
}
return CLuaEnumeration(*this);
}
}
// *************************************************
CLuaObject CLuaObject::operator[](const char *key) const
{
// *************************************************
CLuaObject CLuaObject::operator[](const char *key) const
{
nlassert(key);
nlassert(isValid());
if (!isEnumerable())
@ -245,11 +239,11 @@ CLuaObject CLuaObject::operator[](const char *key) const
CLuaObject subObject(*_LuaState, concatId(getId(), key));
_LuaState->pop(); // pop the sub object
return subObject;
}
}
// *************************************************
CLuaObject CLuaObject::operator[](double key) const
{
// *************************************************
CLuaObject CLuaObject::operator[](double key) const
{
nlassert(isValid());
if (!isEnumerable())
{
@ -264,26 +258,26 @@ CLuaObject CLuaObject::operator[](double key) const
CLuaObject subObject(*_LuaState, concatId(getId(), NLMISC::toString(key)));
_LuaState->pop(); // pop the sub object
return subObject;
}
}
// *************************************************
CLuaObject CLuaObject::at(const char *key) const throw(ELuaNotATable)
{
// *************************************************
CLuaObject CLuaObject::at(const char *key) const throw(ELuaNotATable)
{
if (!isEnumerable()) throw ELuaNotATable(NLMISC::toString("Can't get key '%s' in object '%s' because type is '%s', it is not a table.", key, getId().c_str(), getTypename()).c_str());
return operator[](key);
}
}
// *************************************************
bool CLuaObject::hasKey(const char *key) const
{
// *************************************************
bool CLuaObject::hasKey(const char *key) const
{
if (!isEnumerable()) throw ELuaNotATable(NLMISC::toString("Trying to access key '%s' on object '%s' of type %s.", key, getId().c_str(), getTypename()).c_str());
CLuaObject value = operator[](key);
return (!value.isNil());
}
}
// *************************************************
CLuaObject CLuaObject::newTable(const char *tableName) throw(ELuaNotATable)
{
// *************************************************
CLuaObject CLuaObject::newTable(const char *tableName) throw(ELuaNotATable)
{
nlassert(tableName);
nlassert(isValid());
if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to create a subtable '%s' on object '%s' of type %s (not a table).", tableName, getId().c_str(), getTypename()));
@ -294,11 +288,11 @@ CLuaObject CLuaObject::newTable(const char *tableName) throw(ELuaNotATable)
_LuaState->setTable(-3);
_LuaState->pop();
return at(tableName); //\TODO nico double copy here ...
}
}
// *************************************************
void CLuaObject::setValue(const char *key, const CLuaObject &value) throw(ELuaNotATable)
{
// *************************************************
void CLuaObject::setValue(const char *key, const CLuaObject &value) throw(ELuaNotATable)
{
nlassert(key);
nlassert(isValid());
nlassert(value.isValid());
@ -310,11 +304,11 @@ void CLuaObject::setValue(const char *key, const CLuaObject &value) throw(ELuaN
value.push();
_LuaState->setTable(-3);
_LuaState->pop();
}
}
// *************************************************
void CLuaObject::setNil(const char *key) throw(ELuaNotATable)
{
// *************************************************
void CLuaObject::setNil(const char *key) throw(ELuaNotATable)
{
nlassert(key);
nlassert(isValid());
if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a value 'nil' at key %s on object '%s' of type %s (not a table).", key, getId().c_str(), getTypename()));
@ -324,11 +318,11 @@ void CLuaObject::setNil(const char *key) throw(ELuaNotATable)
_LuaState->pushNil();
_LuaState->setTable(-3);
_LuaState->pop();
}
}
// *************************************************
void CLuaObject::setValue(const char *key, const char *value) throw(ELuaNotATable)
{
// *************************************************
void CLuaObject::setValue(const char *key, const char *value) throw(ELuaNotATable)
{
nlassert(value);
nlassert(key);
nlassert(isValid());
@ -339,17 +333,17 @@ void CLuaObject::setValue(const char *key, const char *value) throw(ELuaNotATab
_LuaState->push(value);
_LuaState->setTable(-3);
_LuaState->pop();
}
}
// *************************************************
void CLuaObject::setValue(const char *key, const std::string &value) throw(ELuaNotATable)
{
// *************************************************
void CLuaObject::setValue(const char *key, const std::string &value) throw(ELuaNotATable)
{
setValue(key, value.c_str());
}
}
// *************************************************
void CLuaObject::setValue(const char *key, bool value) throw(ELuaNotATable)
{
// *************************************************
void CLuaObject::setValue(const char *key, bool value) throw(ELuaNotATable)
{
nlassert(key);
nlassert(isValid());
if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a value '%s' at key %s on object '%s' of type %s (not a table).", value ? "true" : "false", key, getId().c_str(), getTypename()));
@ -359,11 +353,11 @@ void CLuaObject::setValue(const char *key, bool value) throw(ELuaNotATable)
_LuaState->push(value);
_LuaState->setTable(-3);
_LuaState->pop();
}
}
// *************************************************
void CLuaObject::setValue(const char *key, TLuaWrappedFunction value) throw(ELuaNotATable)
{
// *************************************************
void CLuaObject::setValue(const char *key, TLuaWrappedFunction value) throw(ELuaNotATable)
{
nlassert(key);
nlassert(isValid());
if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a function value '%p' at key %s on object '%s' of type %s (not a table).", value, key, getId().c_str(), getTypename()));
@ -373,11 +367,11 @@ void CLuaObject::setValue(const char *key, TLuaWrappedFunction value) throw(ELua
_LuaState->push(value);
_LuaState->setTable(-3);
_LuaState->pop();
}
}
// *************************************************
void CLuaObject::setValue(const char *key, double value) throw(ELuaNotATable)
{
// *************************************************
void CLuaObject::setValue(const char *key, double value) throw(ELuaNotATable)
{
nlassert(key);
nlassert(isValid());
if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a value '%lf' at key %s on object '%s' of type %s (not a table).", value, key, getId().c_str(), getTypename()));
@ -387,11 +381,11 @@ void CLuaObject::setValue(const char *key, double value) throw(ELuaNotATable)
_LuaState->push(value);
_LuaState->setTable(-3);
_LuaState->pop();
}
}
// *************************************************
void CLuaObject::eraseValue(const char *key) throw(ELuaNotATable)
{
// *************************************************
void CLuaObject::eraseValue(const char *key) throw(ELuaNotATable)
{
nlassert(isValid());
nlassert(key);
if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to erase a value with key '%s' on object '%s' of type %s (not a table).", key, getId().c_str(), getTypename()));
@ -401,11 +395,11 @@ void CLuaObject::eraseValue(const char *key) throw(ELuaNotATable)
_LuaState->pushNil();
_LuaState->setTable(-3);
_LuaState->pop();
}
}
// *************************************************
bool CLuaObject::callNoThrow(int numArgs, int numRet)
{
// *************************************************
bool CLuaObject::callNoThrow(int numArgs, int numRet)
{
nlassert(isValid());
if (!isFunction())
{
@ -443,11 +437,11 @@ bool CLuaObject::callNoThrow(int numArgs, int numRet)
break;
}
return false;
}
}
// *************************************************
bool CLuaObject::callMethodByNameNoThrow(const char *name, int numArgs, int numRet)
{
// *************************************************
bool CLuaObject::callMethodByNameNoThrow(const char *name, int numArgs, int numRet)
{
nlassert(isValid());
int initialStackSize = _LuaState->getTop();
if (!isTable() && !isUserData())
@ -465,15 +459,15 @@ bool CLuaObject::callMethodByNameNoThrow(const char *name, int numArgs, int numR
}
_LuaState->setTop(std::max(0, initialStackSize - numArgs));
return false;
}
}
/////////////////////
// CLuaEnumeration //
/////////////////////
/////////////////////
// CLuaEnumeration //
/////////////////////
// *************************************************
CLuaEnumeration::CLuaEnumeration(CLuaObject &table)
{
// *************************************************
CLuaEnumeration::CLuaEnumeration(CLuaObject &table)
{
nlassert(table.isEnumerable());
CLuaState *luaState = table.getLuaState();
CLuaStackChecker lsc(luaState);
@ -494,25 +488,25 @@ CLuaEnumeration::CLuaEnumeration(CLuaObject &table)
_Table = table;
}
}
}
// *************************************************
const CLuaObject &CLuaEnumeration::nextKey() const
{
// *************************************************
const CLuaObject &CLuaEnumeration::nextKey() const
{
nlassert(_HasNext);
return _Key;
}
}
// *************************************************
CLuaObject &CLuaEnumeration::nextValue()
{
// *************************************************
CLuaObject &CLuaEnumeration::nextValue()
{
nlassert(_HasNext);
return _Value;
}
}
// *************************************************
CLuaObject CLuaObject::getMetaTable() const
{
// *************************************************
CLuaObject CLuaObject::getMetaTable() const
{
nlassert(isValid());
CLuaStackChecker lsc(_LuaState);
push();
@ -524,11 +518,11 @@ CLuaObject CLuaObject::getMetaTable() const
_LuaState->pop();
_LuaState->pushNil();
return CLuaObject(*_LuaState);
}
}
// *************************************************
bool CLuaObject::setMetaTable(CLuaObject &metatable)
{
// *************************************************
bool CLuaObject::setMetaTable(CLuaObject &metatable)
{
nlassert(isValid());
nlassert(metatable.isValid());
nlassert(this->getLuaState() == metatable.getLuaState());
@ -538,11 +532,11 @@ bool CLuaObject::setMetaTable(CLuaObject &metatable)
bool ok = _LuaState->setMetaTable(-2);
_LuaState->pop(1);
return ok;
}
}
// *************************************************
std::string CLuaObject::toStringRecurse(uint depth /*=0*/, uint maxDepth /*= 20*/, std::set<const void *> *alreadySeen /*= NULL */) const
{
// *************************************************
std::string CLuaObject::toStringRecurse(uint depth /*=0*/, uint maxDepth /*= 20*/, std::set<const void *> *alreadySeen /*= NULL */) const
{
if (maxDepth != 0 && depth > maxDepth) return "";
const uint INDENT_NUM_BLANK = 2;
std::string indentStr(depth * INDENT_NUM_BLANK, ' ');
@ -600,11 +594,11 @@ std::string CLuaObject::toStringRecurse(uint depth /*=0*/, uint maxDepth /*= 20*
{
return ((indentStr + toString()).c_str());
}
}
}
// *************************************************
void CLuaObject::dump(uint maxDepth /*= 20*/, std::set<const void *> *alreadySeen /*= NULL */) const
{
// *************************************************
void CLuaObject::dump(uint maxDepth /*= 20*/, std::set<const void *> *alreadySeen /*= NULL */) const
{
try
{
std::string str = toStringRecurse(0, maxDepth, alreadySeen);
@ -620,11 +614,11 @@ void CLuaObject::dump(uint maxDepth /*= 20*/, std::set<const void *> *alreadySee
//CLuaIHMRyzom::dumpCallStack();
nlwarning(e.what());
}
}
}
// *************************************************
std::string CLuaObject::concatId(const std::string &left,const std::string &right)
{
// *************************************************
std::string CLuaObject::concatId(const std::string &left,const std::string &right)
{
if (!right.empty() && isdigit(right[0]))
{
if (left.empty()) return "[" + right + "]";
@ -633,11 +627,11 @@ std::string CLuaObject::concatId(const std::string &left,const std::string &righ
if (left.empty()) return right;
return left + "." + right;
}
}
// *************************************************
void CLuaEnumeration::next()
{
// *************************************************
void CLuaEnumeration::next()
{
nlassert(_HasNext);
CLuaState *luaState = _Table.getLuaState();
nlassert(luaState);
@ -652,5 +646,6 @@ void CLuaEnumeration::next()
_HasNext = !_Key.isNil();
_Value.setId(_Table.getId() + "." + _Key.toString());
}
}
}
}

@ -17,31 +17,33 @@
#include "nel/gui/reflect.h"
// Yoyo: Act like a singleton, else registerClass may crash.
CReflectSystem::TClassMap *CReflectSystem::_ClassMap= NULL;
// hack to register the root class at startup
static const struct CRootReflectableClassRegister
namespace NLGUI
{
// Yoyo: Act like a singleton, else registerClass may crash.
CReflectSystem::TClassMap *CReflectSystem::_ClassMap= NULL;
// hack to register the root class at startup
static const struct CRootReflectableClassRegister
{
CRootReflectableClassRegister()
{
TReflectedProperties props;
CReflectSystem::registerClass("CReflectable", "", props);
}
} _RootReflectableClassRegisterInstance;
} _RootReflectableClassRegisterInstance;
//===================================================================================
// release memory
void CReflectSystem::release()
{
//===================================================================================
// release memory
void CReflectSystem::release()
{
delete _ClassMap;
_ClassMap = NULL;
}
}
//===================================================================================
void CReflectSystem::registerClass(const std::string &className, const std::string &parentName, const TReflectedProperties properties)
{
//===================================================================================
void CReflectSystem::registerClass(const std::string &className, const std::string &parentName, const TReflectedProperties properties)
{
if(!_ClassMap) _ClassMap= new TClassMap;
TClassMap::const_iterator it = _ClassMap->find(className);
@ -69,11 +71,11 @@ void CReflectSystem::registerClass(const std::string &className, const std::stri
}
ci.ParentClass = &(it->second);
}
}
}
//===================================================================================
const CReflectedProperty *CReflectSystem::getProperty(const std::string &className, const std::string &propertyName, bool dspWarning)
{
//===================================================================================
const CReflectedProperty *CReflectSystem::getProperty(const std::string &className, const std::string &propertyName, bool dspWarning)
{
if(!_ClassMap) _ClassMap= new TClassMap;
TClassMap::const_iterator it = _ClassMap->find(className);
@ -104,12 +106,12 @@ const CReflectedProperty *CReflectSystem::getProperty(const std::string &classNa
if(dspWarning)
nlwarning("CReflectSystem::getProperty : %s is not a property of class : %s", propertyName.c_str(), className.c_str());
return NULL;
}
}
//===================================================================================
const CClassInfo *CReflectable::getClassInfo()
{
//===================================================================================
const CClassInfo *CReflectable::getClassInfo()
{
if (!CReflectSystem::getClassMap()) return NULL;
// TODO nico : a possible optimization would be to use the address of the static function
// 'getReflectedProperties' as a key into the CClassInfo map. This pointer uniquely identify
@ -120,19 +122,22 @@ const CClassInfo *CReflectable::getClassInfo()
return NULL;
}
return &(it->second);
}
}
//===================================================================================
const CReflectedProperty *CReflectable::getReflectedProperty(const std::string &propertyName, bool dspWarning) const
{
//===================================================================================
const CReflectedProperty *CReflectable::getReflectedProperty(const std::string &propertyName, bool dspWarning) const
{
return CReflectSystem::getProperty(this->getReflectedClassName(), propertyName, dspWarning);
}
}
}
#include "nel/gui/lua_manager.h"
CReflectableRefPtrTarget::~CReflectableRefPtrTarget()
namespace NLGUI
{
CReflectableRefPtrTarget::~CReflectableRefPtrTarget()
{
CLuaState *lua= CLuaManager::getInstance().getLuaState();
if(!lua)
return;
@ -151,9 +156,9 @@ CReflectableRefPtrTarget::~CReflectableRefPtrTarget()
{
lua->pop();
}
}
}
/**
/**
* Data structure pushed in lua (a userdata) to access CReflectableRefPtrTarget derived objects
* These includes element of the GUI.
* if holds a pointer to the reflectable object, and
@ -161,18 +166,18 @@ CReflectableRefPtrTarget::~CReflectableRefPtrTarget()
* \see reflect.h
*/
//
//
inline const CClassInfo &CReflectableLuaRef::getClassInfo() const
{
inline const CClassInfo &CReflectableLuaRef::getClassInfo() const
{
nlassert(Ptr); // class info should not be accessed for a null ptr
if (_ClassInfo) return *_ClassInfo;
_ClassInfo = Ptr->getClassInfo();
return *_ClassInfo;
}
}
const CReflectedProperty *CReflectableLuaRef::getProp(const char *luaStringPtr) const
{
const CReflectedProperty *CReflectableLuaRef::getProp(const char *luaStringPtr) const
{
const CClassInfo &ci = getClassInfo();
CClassInfo::TLuaStrToPropMap::const_iterator it = ci.LuaStrToProp.find(luaStringPtr);
if (it != ci.LuaStrToProp.end())
@ -188,4 +193,6 @@ const CReflectedProperty *CReflectableLuaRef::getProp(const char *luaStringPtr)
lip.Prop = prop;
ci.LuaStrToProp[luaStringPtr] = lip;
return prop;
}
}

@ -23,7 +23,13 @@ namespace NLMISC
class CVector2f;
}
class CLuaObject;
namespace NLGUI
{
class CLuaObject;
}
using namespace NLGUI;
class CDecal;
// TODO nico : this would fit nicely in the particle system animation system (would be more flexible)

@ -25,6 +25,8 @@
#include "interface_property.h"
#include "nel/gui/reflect.h"
using namespace NLGUI;
// ----------------------------------------------------------------------------
class CInterfaceGroup;

@ -22,12 +22,20 @@
#include "nel/misc/cdb_branch.h"
#include "nel/misc/cdb_branch_observing_handler.h"
namespace NLGUI
{
class CReflectedProperty;
}
class CInterfaceElement;
class CReflectedProperty;
class CInterfaceExprValue;
class CInterfaceGroup;
class CInterfaceExprNode;
using namespace NLGUI;
/** A link in an interface.
* A link is an object that can read one or several values from the database, that can evaluate an expression
* on these database entries (simple computation, using the CInterfaceExpr class), and that can affect the result to

@ -3,10 +3,12 @@
#include "nel/gui/lua_ihm.h"
using namespace NLGUI;
class CLuaIHMRyzom
{
public:
static void RegisterRyzomFunctions( NLGUI::CLuaState &ls );
static void RegisterRyzomFunctions( CLuaState &ls );
private:
static void createLuaEnumTable(CLuaState &ls, const std::string &str);

@ -21,8 +21,10 @@
#include "nel/misc/class_registry.h"
#include "../interface_v3/interface_element.h"
class CLuaObject;
namespace NLGUI
{
class CLuaObject;
}
namespace R2
{

@ -21,7 +21,12 @@
#include "nel/gui/lua_object.h"
#include <map>
class CLuaObject;
namespace NLGUI
{
class CLuaObject;
}
using namespace NLGUI;
namespace R2
{

@ -20,8 +20,10 @@
namespace NLGUI
{
class CLuaState;
class CLuaString;
}
class CLuaString;
using namespace NLGUI;
namespace R2
{

@ -24,8 +24,12 @@
#include "../interface_v3/group_map.h"
namespace NLGUI
{
class CLuaObject;
}
class CEntityCL;
class CLuaObject;
class CCtrlPolygon;
namespace R2

@ -29,8 +29,9 @@ class CInterfaceManager;
namespace NLGUI
{
class CEventDescriptor;
class CLuaObject;
}
class CLuaObject;
class CGroupMap;
namespace NLMISC

@ -25,8 +25,10 @@
class CEntity;
class CEntityCL;
class CLuaObject;
namespace NLGUI
{
class CLuaObject;
}
namespace R2
{

@ -22,8 +22,11 @@
#include "nel/gui/lua_object.h"
class CEntity;
class CLuaObject;
namespace NLGUI
{
class CLuaObject;
}
namespace R2
{

@ -25,8 +25,10 @@
#include "displayer_visual_entity.h"
class CEntity;
class CLuaObject;
namespace NLGUI
{
class CLuaObject;
}
namespace R2
{

@ -25,8 +25,10 @@
class CEntity;
class CLuaObject;
namespace NLGUI
{
class CLuaObject;
}
namespace R2
{

Loading…
Cancel
Save