Merge branch 'ryannevell-master'

* ryannevell-master:
  Clean up test cases
  Fix unwrapping of LUA lightuserdata type. Add test case.
diff --git a/Examples/test-suite/lua/Makefile.in b/Examples/test-suite/lua/Makefile.in
index 63b8692..92559bb 100644
--- a/Examples/test-suite/lua/Makefile.in
+++ b/Examples/test-suite/lua/Makefile.in
@@ -15,6 +15,7 @@
 CPP_TEST_CASES += \
 	lua_no_module_global \
 	lua_inherit_getitem  \
+	lua_lightuserdata  \
 
 
 C_TEST_CASES += \
diff --git a/Examples/test-suite/lua/lua_lightuserdata_runme.lua b/Examples/test-suite/lua/lua_lightuserdata_runme.lua
new file mode 100644
index 0000000..c1c3c1d
--- /dev/null
+++ b/Examples/test-suite/lua/lua_lightuserdata_runme.lua
@@ -0,0 +1,7 @@
+require("import") -- the import fn
+import("lua_lightuserdata") -- import lib
+
+local t = lua_lightuserdata
+local d = t.get_lightuserdata()
+local r = t.check_lighuserdata(d)
+assert(r)
diff --git a/Examples/test-suite/lua_lightuserdata.i b/Examples/test-suite/lua_lightuserdata.i
new file mode 100644
index 0000000..9069b6a
--- /dev/null
+++ b/Examples/test-suite/lua_lightuserdata.i
@@ -0,0 +1,17 @@
+%module lua_lightuserdata
+
+%native(get_lightuserdata) int get_lightuserdata(lua_State* L);
+%{
+static int foo;
+int get_lightuserdata(lua_State* L)
+{
+  lua_pushlightuserdata(L, &foo);
+  return 1;
+}
+%}
+
+%inline %{
+bool check_lighuserdata(const void* d) {
+  return d == &foo;
+}
+%}
diff --git a/Lib/lua/luarun.swg b/Lib/lua/luarun.swg
index bd764d6..b8ddf00 100644
--- a/Lib/lua/luarun.swg
+++ b/Lib/lua/luarun.swg
@@ -1765,6 +1765,11 @@
     *ptr=0;
     return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
   }
+  if (lua_islightuserdata(L,index))
+  {
+    *ptr=lua_touserdata(L,index);
+    return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
+  }
   usr=(swig_lua_userdata*)lua_touserdata(L,index);  /* get data */
   if (usr)
   {