aboutsummaryrefslogtreecommitdiff
path: root/src/lua/audio/luaopen_audio.cpp
blob: 992c3ec440545fc0ff58cddb7e96da6e9e2e979a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <SDL2/SDL.h>

#include "lua/luax.h"
#include "libjin/jin.h"

namespace jin
{
namespace lua
{   
    static int l_init(lua_State* L) 
    {
        if (SDL_Init(SDL_INIT_AUDIO) < 0)
        {
            luax_error(L, "could not init audio");
            luax_pushboolean(L, false);
            return 1;
        }
    }
   
    static int l_newSound(lua_State* L) 
    {
        
        return 0; 
    }
    
    static const luaL_Reg f[] = { 
        {"init",  l_init},
        {"Sound", l_newSound},
        {0, 0}
    };

    int luaopen_audio(lua_State* L)
    {
        luax_newlib(L, f);

        return 1; 
    }
}
}