Add optional uservalues count to custom Lua new operator
This commit is contained in:
parent
93de411d2f
commit
8beb7b08fb
2 changed files with 5 additions and 5 deletions
|
@ -496,12 +496,12 @@ std::string register_vconfig_metatable(lua_State *L)
|
|||
|
||||
} // end namespace lua_common
|
||||
|
||||
void* operator new(std::size_t sz, lua_State *L)
|
||||
void* operator new(std::size_t sz, lua_State *L, int nuv)
|
||||
{
|
||||
return lua_newuserdatauv(L, sz, 0);
|
||||
return lua_newuserdatauv(L, sz, nuv);
|
||||
}
|
||||
|
||||
void operator delete(void*, lua_State *L)
|
||||
void operator delete(void*, lua_State *L, int nuv)
|
||||
{
|
||||
// Not sure if this is needed since it's a no-op
|
||||
// It's only called if a constructor throws while using the above operator new
|
||||
|
|
|
@ -41,8 +41,8 @@ namespace lua_common {
|
|||
|
||||
}
|
||||
|
||||
void* operator new(std::size_t sz, lua_State *L);
|
||||
void operator delete(void* p, lua_State *L);
|
||||
void* operator new(std::size_t sz, lua_State *L, int nuv = 0);
|
||||
void operator delete(void* p, lua_State *L, int nuv);
|
||||
|
||||
/**
|
||||
* Like luaL_getmetafield, but returns false if key is an empty string
|
||||
|
|
Loading…
Add table
Reference in a new issue