Clean up test cases

This commit is contained in:
Ryan Nevell 2020-02-17 09:09:58 -08:00
parent 33c59614fc
commit 18608816db
2 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,5 @@
require("import") -- the import fn require("import") -- the import fn
require("lua_lightuserdata") -- import lib import("lua_lightuserdata") -- import lib
local t = lua_lightuserdata local t = lua_lightuserdata
local d = t.get_lightuserdata() local d = t.get_lightuserdata()

View File

@ -2,15 +2,16 @@
%native(get_lightuserdata) int get_lightuserdata(lua_State* L); %native(get_lightuserdata) int get_lightuserdata(lua_State* L);
%{ %{
static int foo;
int get_lightuserdata(lua_State* L) int get_lightuserdata(lua_State* L)
{ {
lua_pushlightuserdata(L, reinterpret_cast<void*>(0x123456)); lua_pushlightuserdata(L, &foo);
return 1; return 1;
} }
%} %}
%inline %{ %inline %{
bool check_lighuserdata(const void* d) { bool check_lighuserdata(const void* d) {
return reinterpret_cast<void*>(0x123456) == d; return d == &foo;
} }
%} %}