26 lines
542 B
C
26 lines
542 B
C
#pragma once
|
|
|
|
#include "lua.h"
|
|
#include "lauxlib.h"
|
|
#include "lualib.h"
|
|
|
|
/* Debug stuff. */
|
|
#define LLUA_DEBUG(str, args...) \
|
|
(fprintf(stdout, "Lua: "str"\n", ## args))
|
|
|
|
#define LLUA_INVALID_PARAMETER() { \
|
|
LLUA_DEBUG("[%s] Invalid parameter", __func__); \
|
|
return 0; \
|
|
}
|
|
|
|
#define LLUA_MIN_ARGS(n) \
|
|
if(lua_gettop(L) < n) { \
|
|
LLUA_DEBUG("[%s] Too few arguments", __func__); \
|
|
return 0; \
|
|
}
|
|
|
|
/* Comfortability macros. */
|
|
#define luaL_dobuffer(L, b, n, s) \
|
|
(luaL_loadbuffer(L, b, n, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
|
|
|