[Add] Actually load the diff library in mission Lua.

This commit is contained in:
Allanis 2013-12-14 00:11:11 +00:00
parent 4ec3dee3e1
commit 72781329cb
2 changed files with 23 additions and 0 deletions

View File

@ -168,6 +168,11 @@ static const luaL_reg diff_methods[] = {
{ 0, 0 }
};
static const luaL_reg diff_cond_methods[] = {
{ "isApplied", diff_isappliedL },
{ 0, 0 }
};
/* Register all the libaries. */
int misn_loadLibs(lua_State* L) {
lua_loadLephisto(L);
@ -181,6 +186,7 @@ int misn_loadLibs(lua_State* L) {
lua_loadHook(L);
lua_loadPilot(L, 0);
lua_loadMusic(L, 0);
lua_loadDiff(L, 0);
return 0;
}
@ -189,6 +195,7 @@ int misn_loadCondLibs(lua_State* L) {
lua_loadSpace(L, 1);
lua_loadVar(L, 1);
lua_loadPlayer(L, 1);
lua_loadDiff(L,1);
return 0;
}
@ -219,6 +226,21 @@ int lua_loadHook(lua_State* L) {
return 0;
}
/**
* @fn int lua_loadDiff(lua_State* L, int readonly)
*
* @brief Loads the diff Lua library.
* @param L Lua State.
* @param readonly Load read only functions.
*/
int lua_loadDiff(lua_State* L, int readonly) {
if(readonly == 0)
luaL_register(L, "diff", diff_methods);
else
luaL_register(L, "diff", diff_cond_methods);
return 0;
}
/*
* Run a mission function.
* -1 on error, 1 on misn.finish() call and 0 normally.

View File

@ -15,4 +15,5 @@ int lua_loadMisn(lua_State* L);
int lua_loadVar(lua_State* L, int readonly);
int lua_loadPlayer(lua_State* L, int readonly);
int lua_loadHook(lua_State* L);
int lua_loadDiff(lua_State* L, int readonly);