naev 0.12.6
nlua_diff.c
Go to the documentation of this file.
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
10#include <lauxlib.h>
11#include <lua.h>
13
14#include "nlua_diff.h"
15
16#include "unidiff.h"
17
18/* diffs */
19static int diffL_apply( lua_State *L );
20static int diffL_remove( lua_State *L );
21static int diffL_isapplied( lua_State *L );
22
23static const luaL_Reg diffL_methods[] = {
24 { "apply", diffL_apply },
25 { "remove", diffL_remove },
26 { "isApplied", diffL_isapplied },
27 { 0, 0 } };
28
34int nlua_loadDiff( nlua_env env )
35{
36 nlua_register( env, "diff", diffL_methods, 0 );
37 return 0;
38}
39
63static int diffL_apply( lua_State *L )
64{
65 const char *name = luaL_checkstring( L, 1 );
66 diff_apply( name );
67 return 0;
68}
69
76static int diffL_remove( lua_State *L )
77{
78 const char *name = luaL_checkstring( L, 1 );
79 diff_remove( name );
80 return 0;
81}
82
90static int diffL_isapplied( lua_State *L )
91{
92 const char *name = luaL_checkstring( L, 1 );
93 lua_pushboolean( L, diff_isApplied( name ) );
94 return 1;
95}
static const luaL_Reg diffL_methods[]
Definition nlua_diff.c:23
static int diffL_isapplied(lua_State *L)
Checks to see if a diff is currently applied.
Definition nlua_diff.c:90
static int diffL_remove(lua_State *L)
Removes a diff by name.
Definition nlua_diff.c:76
static int diffL_apply(lua_State *L)
Lua bindings to apply/remove Universe Diffs.
Definition nlua_diff.c:63
int nlua_loadDiff(nlua_env env)
Loads the diff Lua library.
Definition nlua_diff.c:34
int diff_apply(const char *name)
Applies a diff to the universe.
Definition unidiff.c:658
void diff_remove(const char *name)
Removes a diff from the universe.
Definition unidiff.c:1843
int diff_isApplied(const char *name)
Checks if a diff is currently applied.
Definition unidiff.c:631