From 437a5b07d415e1a74160ddfd804017171d6cc5cb Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 28 Dec 2018 15:42:34 -0200 Subject: Added a warning system to Lua The warning system is just a way for Lua to emit warnings, messages to the programmer that do not interfere with the running program. --- lua.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lua.h') diff --git a/lua.h b/lua.h index 95ce5a2e..a6f8268b 100644 --- a/lua.h +++ b/lua.h @@ -126,6 +126,13 @@ typedef int (*lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud); typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); +/* +** Type for warning functions +*/ +typedef void (*lua_WarnFunction) (void **pud, const char *msg); + + + /* ** generic extra include file @@ -299,6 +306,13 @@ LUA_API int (lua_isyieldable) (lua_State *L); #define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL) +/* +** Warning-related functions +*/ +LUA_API void (lua_setwarnf) (lua_State *L, lua_WarnFunction f, void *ud); +LUA_API void (lua_warning) (lua_State *L, const char *msg); + + /* ** garbage-collection function and options */ -- cgit v1.2.3-55-g6feb