diff options
author | Chad Austin <chad@imvu.com> | 2013-03-26 13:30:01 -0700 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2013-04-12 14:26:43 +0300 |
commit | 56783851c34932a3e6196c38865905d966666ba0 (patch) | |
tree | 9ad76b1025c51a6a4ca99680103cec8125ddc9a5 | |
parent | dbd1a3bfe253ac1df0200427de10f60dc520cfb1 (diff) |
can look up module properties like HEAP8 from within C++ :)
-rwxr-xr-x | src/embind/emval.js | 5 | ||||
-rw-r--r-- | system/include/emscripten/val.h | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/embind/emval.js b/src/embind/emval.js index eb31777b..7153ae6d 100755 --- a/src/embind/emval.js +++ b/src/embind/emval.js @@ -99,6 +99,11 @@ function __emval_get_global(name) { return __emval_register(global[name]); } +function __emval_get_module_property(name) { + name = Pointer_stringify(name); + return __emval_register(Module[name]); +} + function __emval_get_property(handle, key) { return __emval_register(_emval_handle_array[handle].value[_emval_handle_array[key].value]); } diff --git a/system/include/emscripten/val.h b/system/include/emscripten/val.h index 48f8ef69..91f775a7 100644 --- a/system/include/emscripten/val.h +++ b/system/include/emscripten/val.h @@ -27,6 +27,7 @@ namespace emscripten { /*, ... */); EM_VAL _emval_get_global(const char* name); + EM_VAL _emval_get_module_property(const char* name); EM_VAL _emval_get_property(EM_VAL object, EM_VAL key); void _emval_set_property(EM_VAL object, EM_VAL key, EM_VAL value); void _emval_as(EM_VAL value, TYPEID returnType); @@ -92,6 +93,10 @@ namespace emscripten { return val(internal::_emval_get_global(name)); } + static val module_property(const char* name) { + return val(internal::_emval_get_module_property(name)); + } + template<typename T> explicit val(const T& value) { typedef internal::BindingType<T> BT; |