2 * See Licensing and Copyright notice in naev.h
8 * @brief Contains Lua bindings for the console.
24 static int cli_missionStart( lua_State
*L
);
25 static int cli_missionTest( lua_State
*L
);
26 static const luaL_reg cli_methods
[] = {
27 { "missionStart", cli_missionStart
},
28 { "missionTest", cli_missionTest
},
30 }; /**< CLI Lua methods. */
34 * @brief Loads the CLI Lua library.
37 * @return 0 on success.
39 int nlua_loadCLI( lua_State
*L
)
41 luaL_register(L
, "cli", cli_methods
);
46 * @brief CLI generic Lua bindings.
48 * An example would be:
50 * cli.mission("Pirate Bounty") -- Triggers the Pirate Bounty mission.
56 * @brief Starts a mission without testing conditionals.
58 * @usage cli.missionStart( "Pirate Bounty" )
60 * @luaparam misn Name of the mission to start.
61 * @luafunc missionStart( misn )
63 static int cli_missionStart( lua_State
*L
)
67 str
= luaL_checkstring(L
, 1);
68 if (mission_start( str
)) {
69 NLUA_ERROR(L
,"Failed to start mission.");
77 * @brief Starts a mission by testing all the conditionals.
79 * @usage cli.missionTest( "Pirate Bounty" )
81 * @luaparam misn Name of the mission to start.
82 * @luafunc missionTest( misn )
84 static int cli_missionTest( lua_State
*L
)
88 str
= luaL_checkstring(L
, 1);
89 if (mission_start( str
)) {
90 NLUA_ERROR(L
,"Failed to start mission.");