diff options
author | wm4 <wm4@nowhere> | 2014-10-19 00:09:27 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-10-19 05:51:25 +0200 |
commit | daab65693c4994ea350f6dcfcf43653c57175ea5 (patch) | |
tree | 8cff6b2fd83ab6a57dd1aa400ba6651750ce52b2 /DOCS | |
parent | 76af31b0eb51d50f7dc17db3fdb3cc3e40fac187 (diff) |
lua: add a helper to auto-free temporary C memory
Using the Lua API is a big PITA because it uses longjmp() error
handling. That is, a Lua API function could any time raise an error and
longjmp() to a lower part of the stack. This kind of "exception
handling" is completely foreign to C, and there are no proper ways to
clean up the "skipped" stack frames.
Other than avoiding such situations entirely, the only way to deal with
this is using Lua "userdata", which is basically a malloc'ed data block
managed by the Lua GC, and which can have a destructor function
associated (__gc metamethod).
This requires an awful lot of code (because the Lua API is just so
terrible), so I avoided this utnil now. But it looks like this will make
some of the following commits much easier, so here we go.
Diffstat (limited to 'DOCS')
0 files changed, 0 insertions, 0 deletions