summaryrefslogtreecommitdiff
path: root/src/miniaudio/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/miniaudio/setup.c')
-rw-r--r--src/miniaudio/setup.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/miniaudio/setup.c b/src/miniaudio/setup.c
new file mode 100644
index 0000000..774bf39
--- /dev/null
+++ b/src/miniaudio/setup.c
@@ -0,0 +1,31 @@
+#include <lua.h>
+#include <lauxlib.h>
+#include <miniaudio.h>
+#include "util/util.h"
+#include "audio.h"
+
+
+#define X(name, mt) const char *mt = name;
+AUDIO_METATABLES
+#undef X
+
+
+void setup_audio(lua_State *L, int honey_tbl)
+{
+ #define X(n, mt) luaL_newmetatable(L, mt); lua_pop(L, 1);
+ AUDIO_METATABLES
+ #undef X
+
+ struct honey_tbl_t audio[] = {
+ #define X(name, func) H_FUNC(name, func),
+ AUDIO_FUNCTIONS
+ #undef X
+
+ /* ma_result values */
+ H_ENUM(MA_SUCCESS),
+
+ H_END,
+ };
+ create_table(L, audio);
+ lua_setfield(L, honey_tbl, "ma");
+}