katlogic/pudata
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
lua_pushuserdata() polyfill Sometimes, one needs to push existing userdata by pointer. This is not safe (as the pointer might be stale), therefore it is not part of core Lua api. This header file should be included after Lua headers - mainly because it overrides lua_newuserdata() with a macro, all hell would break loose otherwise. After that, you can push userdata by pointer. In case the userdata object has been collected in the meantime, nil is pushed on stack. This is handy for debugging, with native function you'd get dangling pointer on Lua heap. It is also very slow, so it is not a good idea to use this in release / performance bound code. Patching Lua(JIT) with native function is left as an excercise for the reader. -- k
About
lua_pushuserdata() polyfill
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published