Avoid redundancies in generated exception messages and include Lua
tracebacks when catching exceptions in protected calls.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Properly handle accesses to properties of the userdatum itself in the
lua_uv_index() __index metamethod and treat integer keys as array indexes
in case of wrapped ucode array values. Also fix an incorrect refcount
decrement in the function.
Also fix uc_lua_vm_get() and uc_lua_lv_getraw() to gracefully handle
accesses to not defined or non-table values and ensure that those functions
properly reset the Lua stack after they complete.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Expose ucode arrays and objects with prototypes as userdata proxy objects
to Lua and extend the userdata metadatable with an __index metamethod to
lookup not found properties in the ucode values prototype chain.
Also extend the __call metamethod implementation to infer method call
status from the activation record in order to invoke ucode functions with
the correct `this` context when called as method from Lua.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Reopen self with dlopen(RTLD_GLOBAL) in order to export liblua symbols for
runtime loading of dynamic Lua extensions.
Reported-by: Stijn Tintel <stijn@linux-ipv6.be>
Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>