Просмотр исходного кода

Remove CFunction restriction from MemberMap

Ole лет назад: 9
Родитель
Сommit
5ea0af77a7
2 измененных файлов с 5 добавлено и 2 удалено
  1. 4 1
      examples/usertypes.cpp
  2. 1 1
      lib/luwra/usertypes.hpp

+ 4 - 1
examples/usertypes.cpp

@@ -40,7 +40,8 @@ int main() {
 		{
 			LUWRA_MEMBER(Point, scale),
 			LUWRA_MEMBER(Point, x),
-			LUWRA_MEMBER(Point, y)
+			LUWRA_MEMBER(Point, y),
+			{"test", 1337}
 		},
 		// Meta methods may be registered aswell
 		{
@@ -66,6 +67,8 @@ int main() {
 		// Modify 'x' property
 		"p:x(10)\n"
 		"print('p.x =', p:x())\n"
+
+		"print('test', p.test)"
 	);
 
 	// Invoke the attached script

+ 1 - 1
lib/luwra/usertypes.hpp

@@ -217,7 +217,7 @@ struct Value<U*> {
 	}
 };
 
-using MemberMap = std::map<std::string, CFunction>;
+using MemberMap = std::map<std::string, Pushable>;
 
 /**
  * Register the metatable for user type `T`. This function allows you to register methods