/
nlua_naev.c
67 lines (57 loc) · 1.09 KB
/
nlua_naev.c
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* See Licensing and Copyright notice in naev.h
*/
/**
* @file nlua_naev.c
*
* @brief Contains NAEV generic Lua bindings.
*/
#include "nlua_naev.h"
#include "naev.h"
#include "lauxlib.h"
#include "nlua.h"
#include "nluadef.h"
#include "log.h"
/* naev */
static int naev_lang( lua_State *L );
static const luaL_reg naev_methods[] = {
{ "lang", naev_lang },
{0,0}
}; /**< NAEV Lua methods. */
/**
* @brief Loads the NAEV Lua library.
*
* @param L Lua state.
* @return 0 on success.
*/
int lua_loadNaev( lua_State *L )
{
luaL_register(L, "naev", naev_methods);
return 0;
}
/**
* @brief NAEV generic Lua bindings.
*
* An example would be:
* @code
* if naev.lang() == "en" then
* --Language is English.
* end
* @endcode
*
* @luamod naev
*/
/**
* @brief Gets the language NAEV is currently using.
*
* @usage if naev.lang() == "en" then -- Language is english
*
* @luareturn Two character identifier of the language.
* @luafunc lang()
*/
static int naev_lang( lua_State *L )
{
/** @todo multilanguage stuff */
lua_pushstring(L,"en");
return 1;
}