summaryrefslogtreecommitdiff
path: root/Examples/test-suite/lua_lightuserdata.i
diff options
context:
space:
mode:
authorRyan Nevell <rnevell@apple.com>2020-02-17 08:45:42 -0800
committerRyan Nevell <rnevell@apple.com>2020-02-17 09:16:24 -0800
commit33c59614fc55d6ef8404b609836dee75db69bd38 (patch)
tree638f203beadcd7203338c8588b4d64c966c01a1a /Examples/test-suite/lua_lightuserdata.i
parentb465531141a95ef29062e219b8683726beacf9a1 (diff)
downloadswig-33c59614fc55d6ef8404b609836dee75db69bd38.tar.gz
Fix unwrapping of LUA lightuserdata type. Add test case.
Diffstat (limited to 'Examples/test-suite/lua_lightuserdata.i')
-rw-r--r--Examples/test-suite/lua_lightuserdata.i16
1 files changed, 16 insertions, 0 deletions
diff --git a/Examples/test-suite/lua_lightuserdata.i b/Examples/test-suite/lua_lightuserdata.i
new file mode 100644
index 000000000..08e15c93c
--- /dev/null
+++ b/Examples/test-suite/lua_lightuserdata.i
@@ -0,0 +1,16 @@
+%module lua_lightuserdata
+
+%native(get_lightuserdata) int get_lightuserdata(lua_State* L);
+%{
+int get_lightuserdata(lua_State* L)
+{
+ lua_pushlightuserdata(L, reinterpret_cast<void*>(0x123456));
+ return 1;
+}
+%}
+
+%inline %{
+bool check_lighuserdata(const void* d) {
+ return reinterpret_cast<void*>(0x123456) == d;
+}
+%}