return 1; \
}
+enum MyEnum
+{
+ ENUM_FIRST,
+ ENUM_ANOTHER,
+ ENUM_LAST
+};
struct Base
{
naRef member(const nasal::CallContext&) { return naNil(); }
using namespace nasal;
+ r = to_nasal(c, ENUM_ANOTHER);
+ VERIFY( from_nasal<int>(c, r) == ENUM_ANOTHER );
+
r = to_nasal(c, "Test");
VERIFY( strncmp("Test", naStr_data(r), naStr_len(r)) == 0 );
VERIFY( from_nasal<std::string>(c, r) == "Test" );
naRef to_nasal_helper(naContext c, const free_function_t& func);
+ /**
+ * Convert an enum value to the according numeric value
+ */
+ template<class T>
+ typename boost::enable_if< boost::is_enum<T>, naRef >::type
+ to_nasal_helper(naContext c, T val)
+ {
+ return naNum(val);
+ }
+
/**
* Convert a numeric type to Nasal number
*/