-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Lua global variables library (#6472)
* add global variables library * nested namespaces
- Loading branch information
Showing
5 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// | ||
|
||
#include "globalincs/version.h" | ||
|
||
#include "globals.h" | ||
|
||
#include "missionui/missionscreencommon.h" | ||
#include "playerman/managepilot.h" | ||
|
||
namespace scripting::api { | ||
|
||
//**********LIBRARY: Globals | ||
ADE_LIB(l_GlobalVariables, "GlobalVariables", "gl", "Library of global values"); | ||
|
||
ADE_VIRTVAR(MAX_PILOTS, | ||
l_GlobalVariables, | ||
nullptr, | ||
"Gets the maximum number of possible pilots.", | ||
"number", | ||
"The maximum number of pilots") | ||
{ | ||
return ade_set_args(L, "i", MAX_PILOTS); | ||
} | ||
|
||
ADE_VIRTVAR(MAX_WING_SLOTS, | ||
l_GlobalVariables, | ||
nullptr, | ||
"The maximum ships that can be in a loadout wing", | ||
"number", | ||
"A maximum number of ships") | ||
{ | ||
|
||
return ade_set_args(L, "i", MAX_WING_SLOTS); | ||
} | ||
|
||
ADE_VIRTVAR(MAX_WING_BLOCKS, | ||
l_GlobalVariables, | ||
nullptr, | ||
"The maximum wings that can be in a loadout", | ||
"number", | ||
"A maximum number of wings") | ||
{ | ||
|
||
return ade_set_args(L, "i", MAX_WING_BLOCKS); | ||
} | ||
|
||
ADE_VIRTVAR(MAX_SHIP_PRIMARY_BANKS, | ||
l_GlobalVariables, | ||
nullptr, | ||
"The maximum primary banks a ship can have", | ||
"number", | ||
"A maximum number of primary banks") | ||
{ | ||
|
||
return ade_set_args(L, "i", MAX_SHIP_PRIMARY_BANKS); | ||
} | ||
|
||
ADE_VIRTVAR(MAX_SHIP_SECONDARY_BANKS, | ||
l_GlobalVariables, | ||
nullptr, | ||
"The maximum secondary banks a ship can have", | ||
"number", | ||
"A maximum number of secondary banks") | ||
{ | ||
|
||
return ade_set_args(L, "i", MAX_SHIP_SECONDARY_BANKS); | ||
} | ||
|
||
} // namespace scripting::api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
|
||
#include "scripting/ade_api.h" | ||
|
||
namespace scripting::api { | ||
|
||
DECLARE_ADE_LIB(l_GlobalVariables); | ||
|
||
} // namespace scripting::api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters