Implemented entity.GetType() in lua
This will only work for userdata decented from the Entity base class. Using something else results in undefined behavior.
This commit is contained in:
@@ -21,6 +21,10 @@
|
||||
*/
|
||||
#include "monster_data.hpp"
|
||||
|
||||
MonsterData::MonsterData(): Entity("monster") {
|
||||
//EMPTY
|
||||
}
|
||||
|
||||
std::string MonsterData::SetAvatar(std::string s) {
|
||||
return avatar = s;
|
||||
}
|
||||
|
||||
@@ -24,11 +24,13 @@
|
||||
|
||||
#include "entity.hpp"
|
||||
|
||||
#include "lua.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
class MonsterData: public Entity {
|
||||
public:
|
||||
MonsterData() = default;
|
||||
MonsterData();
|
||||
~MonsterData() = default;
|
||||
|
||||
std::string SetAvatar(std::string);
|
||||
@@ -41,7 +43,7 @@ private:
|
||||
friend class MonsterManager;
|
||||
|
||||
std::string avatar;
|
||||
int scriptRef;
|
||||
int scriptRef = LUA_NOREF;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user