$treeview $search $mathjax
Stratagus
2.2.6
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
Go to the source code of this file.
Classes | |
struct | _lua_user_data_ |
struct | _binop_ |
struct | _NumberDesc_ |
for Bin operand a ?? b More... | |
struct | _UnitDesc_ |
struct | _StringDesc_ |
script.h - The clone configuration language headerfile. | |
#define | LuaError(l, args) |
#define | LuaCheckArgs(l, args) |
enum | { LuaUnitType = 100, LuaSoundType } |
enum | ENumber { ENumber_Lua, ENumber_Dir, ENumber_Add, ENumber_Sub, ENumber_Mul, ENumber_Div, ENumber_Min, ENumber_Max, ENumber_Rand, ENumber_Gt, ENumber_GtEq, ENumber_Lt, ENumber_LtEq, ENumber_Eq, ENumber_NEq, ENumber_VideoTextLength, ENumber_StringFind, ENumber_UnitStat } |
enum | EUnit { EUnit_Ref } |
All possible value for a number. More... | |
enum | EString { EString_Lua, EString_Dir, EString_Concat, EString_String, EString_InverseVideo, EString_If, EString_UnitName, EString_SubString, EString_Line } |
All possible value for a unit. More... | |
enum | ES_GameInfo { ES_GameInfo_Objectives } |
All possible value for a string. More... | |
enum | EnumVariable { VariableValue = 0, VariableMax, VariableIncrease, VariableDiff, VariablePercent, VariableName } |
All possible value for a game info string. More... | |
enum | EnumUnit { UnitRefItSelf = 0, UnitRefInside, UnitRefContainer, UnitRefWorker, UnitRefGoal } |
typedef struct _lua_user_data_ | LuaUserData |
typedef struct _NumberDesc_ | NumberDesc |
typedef struct _UnitDesc_ | UnitDesc |
typedef struct _StringDesc_ | StringDesc |
typedef struct _binop_ | BinOp |
lua_State * | Lua |
int | CclInConfigFile |
NumberDesc * | Damage |
true if gain XP by dealing damage, false if by killing. | |
int | LuaLoadFile (const std::string &file) |
int | LuaCall (int narg, int clear, bool exitOnError=true) |
const char * | LuaToString (lua_State *l, int narg) |
True while config file parsing. | |
int | LuaToNumber (lua_State *l, int narg) |
bool | LuaToBoolean (lua_State *l, int narg) |
void | CclGarbageCollect (int fast) |
void | InitCcl () |
Perform garbage collection. | |
void | LoadCcl (const std::string &filename) |
Initialise ccl. | |
void | SaveCcl (CFile *file) |
Load ccl config file. | |
void | SavePreferences () |
Save CCL module. | |
int | CclCommand (const std::string &command, bool exitOnError=true) |
Save user preferences. | |
EnumVariable | Str2EnumVariable (lua_State *l, const char *s) |
Damage calculation for missile. | |
NumberDesc * | CclParseNumberDesc (lua_State *l) |
UnitDesc * | CclParseUnitDesc (lua_State *l) |
Parse a number description. | |
StringDesc * | CclParseStringDesc (lua_State *l) |
Parse a unit description. | |
StringDesc * | NewStringDesc (const char *s) |
Parse a string description. | |
int | EvalNumber (const NumberDesc *numberdesc) |
Create a StringDesc with const string. | |
CUnit * | EvalUnit (const UnitDesc *unitdesc) |
Evaluate the number. | |
std::string | EvalString (const StringDesc *s) |
Evaluate the unit. | |
void | FreeNumberDesc (NumberDesc *number) |
Evaluate the string. | |
void | FreeUnitDesc (UnitDesc *unitdesc) |
Free number description content. (no pointer itself). | |
void | FreeStringDesc (StringDesc *s) |
Free unit description content. (no pointer itself). |
#define LuaCheckArgs | ( | l, | |||
args | ) |
Value:
do { \ if (lua_gettop(l) != args) { \ LuaError(l, "incorrect argument"); \ } \ } while (0)
#define LuaError | ( | l, | |||
args | ) |
Value:
do { \ fprintf(stdout, "%s:%d: %s: ", __FILE__, __LINE__, __func__); \ fprintf(stdout, args); \ fprintf(stdout, "\n"); \ lua_pushfstring(l, args); lua_error(l); \ } while (0)
typedef struct _lua_user_data_ LuaUserData |
typedef struct _NumberDesc_ NumberDesc |
Number description. Use to describe complex number in script to use when game running.
typedef struct _StringDesc_ StringDesc |
String description Use to describe complex string in script to use when game running.
typedef struct _UnitDesc_ UnitDesc |
Unit description Use to describe complex unit in script to use when game running.
enum ENumber |
enum EnumUnit |
enum EnumVariable |
All possible value for a game info string.
Enumeration to know which variable to be selected.
enum ES_GameInfo |
enum EString |
All possible value for a unit.
enum EUnit |
int CclCommand | ( | const std::string & | command, | |
bool | exitOnError | |||
) |
Save user preferences.
Send command to ccl.
command | Zero terminated command string. |
void CclGarbageCollect | ( | int | ) |
Perform CCL garbage collection
fast | set this flag to disable slow GC (during game) |
NumberDesc* CclParseNumberDesc | ( | lua_State * | l | ) |
Return number.
l | lua state. |
StringDesc* CclParseStringDesc | ( | lua_State * | l | ) |
Parse a unit description.
Return String description.
l | lua state. |
UnitDesc* CclParseUnitDesc | ( | lua_State * | l | ) |
Parse a number description.
Return unit referernce definition.
l | lua state. |
int EvalNumber | ( | const NumberDesc * | number | ) |
Create a StringDesc with const string.
compute the number expression
number | struct with definition of the calculation. |
std::string EvalString | ( | const StringDesc * | s | ) |
Evaluate the unit.
compute the string expression
s | struct with definition of the calculation. |
Evaluate the number.
compute the Unit expression
unitdesc | struct with definition of the calculation. |
void FreeNumberDesc | ( | NumberDesc * | number | ) |
Evaluate the string.
Free the number expression content. (not the pointer itself).
number | struct to free |
void FreeStringDesc | ( | StringDesc * | s | ) |
Free unit description content. (no pointer itself).
Free the String expression content. (not the pointer itself).
s | struct to free |
void FreeUnitDesc | ( | UnitDesc * | ) |
Free number description content. (no pointer itself).
Free the unit expression content. (not the pointer itself).
unitdesc | struct to free |
void InitCcl | ( | ) |
Perform garbage collection.
Register some lua function.
void LoadCcl | ( | const std::string & | filename | ) |
Initialise ccl.
Load stratagus config file.
int LuaCall | ( | int | narg, | |
int | clear, | |||
bool | exitOnError | |||
) |
Call a lua function
narg | Number of arguments | |
clear | Clear the return value(s) | |
exitOnError | Exit the program when an error occurs |
int LuaLoadFile | ( | const std::string & | file | ) |
Load a file and execute it
file | File to load and execute |
bool LuaToBoolean | ( | lua_State * | l, | |
int | narg | |||
) |
Convert lua boolean to bool. It also checks type and exits in case of error.
l | Lua state. | |
narg | Argument number. |
int LuaToNumber | ( | lua_State * | l, | |
int | narg | |||
) |
Convert lua number in C number. It checks also type and exit in case of error.
l | Lua state. | |
narg | Argument number. |
const char* LuaToString | ( | lua_State * | l, | |
int | narg | |||
) |
True while config file parsing.
Convert lua string in char*. It checks also type and exit in case of error.
l | Lua state. | |
narg | Argument number. |
StringDesc* NewStringDesc | ( | const char * | s | ) |
Parse a string description.
Create a StringDesc with const string.
s | direct value for the StringDesc |
void SaveCcl | ( | CFile * | file | ) |
Load ccl config file.
Save CCL Module.
file | Save file. |
void SavePreferences | ( | ) |
Save CCL module.
Save user preferences
EnumVariable Str2EnumVariable | ( | lua_State * | l, | |
const char * | s | |||
) |
Damage calculation for missile.
transform string in corresponding index.
Return enum from string about variable component.
l | Lua State. | |
s | string to convert. |
int CclInConfigFile |
true if gain XP by dealing damage, false if by killing.
lua_State* Lua |