Lua System
Development < Lua Scripting < Lua System
All Lua Contexts
Script.Kill
( )
return: nil
- No description available
Script.GetName
( )
return: string luaInstanceName
- Returns the luaInstanceName (e.g. "LuaUI", "LuaRules", "LuaGaia", ...).
Script.GetSynced
( )
return: bool is_synced
- No description available
Script.GetFullCtrl
( )
return: bool has_fullctrl
- No description available
Script.GetFullRead
( )
return: bool has_fullread
- No description available
Script.GetCtrlTeam
( )
return: number ctrl_teamID
- No description available
Script.GetReadTeam
( )
return: number read_teamID
- No description available
Script.GetReadAllyTeam
( )
return: number read_allyTeamID
- No description available
Script.GetSelectTeam
( )
return: number select_teamID
- Defines which teamunits can be selected via Spring.SelectUnitMap/Spring.SelectUnitArray.
Script.GetGlobal
( )
return: nil | table globalEnv
- Returns nil if not in dev-mode.
Script.GetRegistry
( )
return: nil | table registryEnv
- Returns nil if not in dev-mode.
Script.GetCallInList
( )
return: table known_callins
- Known CallIns are:
known_callins = {
["CallInName"] = { unsynced = boolean, controller = boolean }, (`controller` is true for
all CallIns which's return values are used by the engine for synced code,
e.g. "AllowUnitCreation" is a controller)
...
}
Script.IsEngineMinVersion
( major [, minor [, commits ]] )
return: nil | boolean isMinVersion
- No description available
Special team constants
number NO_ACCESS_TEAM
- No description available
number
ALL_ACCESS_TEAM
- No description available
LuaUI only
Spring.SetShockFrontFactors
( number minArea,
number minPower,
number distAdj )
return: nil
- No description available
Spring.UpdateCallIn
( string callin_name )
return: nil
- No description available
LuaGadgets only
Synced
number COBSCALE
- Number containing the cobscale factor, which is applied to transform the variables assigned via unit cob animation scripts for use inside the engine (default: 65536).
Script.AddActionFallback
( string command,
string help )
return: nil | boolean ???
- No description available
Script.RemoveActionFallback
( string command )
return: nil | boolean ???
- No description available
Script.UpdateCallIn
( string callin_name )
return: nil
- No description available
Script.SetWatchFeature
( number featureDefID,
boolean enable )
return: nil
- Enables the `UnitFeatureCollision` callin for a specific FeatureDef.
Script.GetWatchFeature
( number featureDefID )
return: nil | boolean enabled
- No description available
Script.SetWatchUnit
( number unitDefID,
boolean enable )
return: nil
- Enables the `UnitUnitCollision`, `UnitFeatureCollision` and `UnitMoveFailed` callins for a specific UnitDef.
Script.GetWatchUnit
( number unitDefID )
return: nil | boolean enabled
- No description available
Script.SetWatchWeapon
( number weaponDefID,
boolean enable )
return: nil
- Enables the `Explosion` and (as of 0.83+) `ProjectileCreated` and `ProjectileDestroyed` callins for a specific WeaponDef.
Script.GetWatchWeapon
( number weaponDefID )
return: nil | boolean enabled
- No description available
Script.GetWatchWeapon
( number weaponDefID )
return: nil | boolean enabled
- No description available
SendToUnsynced
( arg1,
arg2,
... )
return: nil
- Just nil, number, string and boolean datatypes are allowed as arguments! NO tables, userdatas, ...
CallAsTeam
( number teamID,
lua_function f,
arg1,
arg2,
... )
return: nil
or
CallAsTeam
( table access,
lua_function f,
arg1,
arg2,
... )
return: nil
- LOS checking depends on the `selected` team, this functions allows to select another one.
access = {
[ctrl = number teamID,]
[read = number teamID,]
[select = number teamID,]
}
Unsynced
Script.UpdateCallIn
( string callin_name )
return: nil
- No description available
CallAsTeam
( number teamID,
lua_function f,
arg1,
arg2,
... )
return: nil
or
CallAsTeam
( table access,
lua_function f,
arg1,
arg2,
... )
return: nil
- LOS checking depends on the `selected` team, this functions allows to select another one.
access = {
[ctrl = number teamID,] (limits Spring.GiveOrderXYZ)
[read = number teamID,] (limits reading of unit params, e.g. Spring.GetUnitLosState)
[select = number teamID,] (limits Spring.SelectUnitXYZ)
}
LuaRules only
Synced
Script.PermitHelperAIs
( boolean permit )
return: nil
- No description available