示例#1
0
 UserdataMetatable &addStaticFunction(const char *name, Fun f) {
   if (has_key(name)) {
     throw KaguyaException(std::string(name) + " is already registered.");
     return *this;
   }
   member_map_[name] = AnyDataPusher(kaguya::function(f));
   return *this;
 }
示例#2
0
 UserdataMetatable &addStaticField(const char *name, const Data &d) {
   if (has_key(name)) {
     throw KaguyaException(std::string(name) + " is already registered.");
     return *this;
   }
   member_map_[name] = AnyDataPusher(d);
   return *this;
 }
示例#3
0
 UserdataMetatable &addPropertyAny(const char *name, GetterType getter) {
   if (has_key(name)) {
     throw KaguyaException(std::string(name) + " is already registered.");
     return *this;
   }
   property_map_[name] = AnyDataPusher(function(getter));
   return *this;
 }
示例#4
0
 UserdataMetatable &addProperty(const char *name, Ret class_type::*mem) {
   if (has_key(name)) {
     throw KaguyaException(std::string(name) + " is already registered.");
     return *this;
   }
   property_map_[name] = AnyDataPusher(kaguya::function(mem));
   return *this;
 }
示例#5
0
 /// @brief assign function
 /// @param name name for lua
 /// @param f member function object.
 UserdataMetatable &addFunction(const char *name, PolymorphicMemberInvoker f) {
   if (has_key(name)) {
     throw KaguyaException(std::string(name) + " is already registered. To "
                                               "overload a function, use "
                                               "addOverloadedFunctions");
     return *this;
   }
   member_map_[name] = AnyDataPusher(kaguya::function(f));
   return *this;
 }
示例#6
0
  UserdataMetatable &addOverloadedFunctions(const char *name, Funcs... f) {
    if (has_key(name)) {
      throw KaguyaException(std::string(name) + " is already registered.");
      return *this;
    }

    member_map_[name] = AnyDataPusher(overload(f...));

    return *this;
  }
示例#7
0
 UserdataMetatable &addProperty(const char *name,
                                GetType (*getter)(const class_type &),
                                void (*setter)(class_type &, SetType)) {
   if (has_key(name)) {
     throw KaguyaException(std::string(name) + " is already registered.");
     return *this;
   }
   property_map_[name] = AnyDataPusher(overload(getter, setter));
   return *this;
 }
示例#8
0
		UserdataMetatable& addFunction(const char* name, Ret class_type::* f)
		{
			if (has_key(name))
			{
				throw KaguyaException(std::string(name) + " is already registered. To overload a function, use addOverloadedFunctions");
				return *this;
			}
			member_map_[name] = AnyDataPusher(kaguya::function(f));
			return *this;
		}