13#include "attributes.h"
18static_assert( 1,
"" );
24#pragma GCC diagnostic push
25#pragma GCC diagnostic ignored "-Wredundant-decls"
27NORETURN
extern int lua_error( lua_State *L );
28NORETURN
extern int luaL_error( lua_State *L,
const char *fmt, ... );
29NORETURN
extern int luaL_typerror( lua_State *L,
int narg,
const char *tname );
31#pragma GCC diagnostic pop
37#define NLUA_DEBUG( str, ... ) \
38 ( DEBUG( "Lua: " str "\n", ##__VA_ARGS__ ), abort() )
40#define NLUA_DEBUG( str, ... ) ( DEBUG( "Lua: " str "\n", ##__VA_ARGS__ ) )
42#define NLUA_INVALID_PARAMETER( L, idx ) \
44 DEBUG( "Invalid parameter %d for %s.", idx, __func__ ); \
45 return luaL_error( L, "Invalid parameter %d for %s.", idx, __func__ ); \
47#define NLUA_INVALID_PARAMETER_NORET( L, idx ) \
49 DEBUG( "Invalid parameter %d for %s.", idx, __func__ ); \
50 luaL_error( L, "Invalid parameter %d for %s.", idx, __func__ ); \
52#define NLUA_MIN_ARGS( n ) \
53 if ( lua_gettop( L ) < n ) { \
54 DEBUG( "Too few arguments for %s.", __func__ ); \
55 return luaL_error( L, "Too few arguments for %s.", __func__ ); \
61#define NLUA_ERROR( L, str, ... ) ( luaL_error( L, str, ##__VA_ARGS__ ) )