All array-like Lua tables that are created/filled by the engine, got the "n" member removed, which contained the arrays size. This is as of now in current spring master, and will be in the next release.
necessary changes
Instead of reading the "n" member of tables to get their size, you have to use the # operator now.
This change is backwards compatible; if you apply it to your Lua, it will also work in current release.
-> do it asap!

example:
Code: Select all
- for i=1,ud.weapons.n do
+ for i=1,#ud.weapons do
Your Lua code will be a bit cleaner, and more portable, and in theory it would be a bit faster (unnoticeable in practice).
how to test
windows installer: http://springrts.com/dl/buildbot/defaul ... 6b01f8.exe
linux: git clone git://github.com/hoijui/spring.git
related commits
https://github.com/spring/spring/commit ... 9779c9f7a9
https://github.com/spring/spring/commit ... a810fa9336
https://github.com/spring/spring/commit ... 9c5c883d60
https://github.com/spring/spring/commit ... 014b9209f7
affected Lua stuff
No guarantee for completeness:
Code: Select all
LayoutButtons
CommandFallback
AllowCommand
GetUnitPieceList
GetUnitPieceInfo
UnitDef.buildOptions
UnitDef.weapons
UnitDef.sounds.* =>
UnitDef.sounds.select
UnitDef.sounds.ok
UnitDef.sounds.arrived
UnitDef.sounds.build
UnitDef.sounds.repair
UnitDef.sounds.working
UnitDef.sounds.underattack
UnitDef.sounds.cant
UnitDef.sounds.activate
UnitDef.sounds.deactivate
GetSelectedUnits
GetActiveCmdDescs
GetConsoleBuffer
GetKeyBindings
GetActionHotKeys
GetGroupUnits
GetGroupUnitsSorted
GetGroupUnitsCounts
GetUnitCmdDescs
UnpackU8
UnpackU16
UnpackU32
UnpackS8
UnpackS16
UnpackS32
UnpackF32
WeaponDef.hitSound
WeaponDef.fireSound
GetPlayerRoster
GetPressedKeys
GetGlobalTexNames
DirList
SubDirs
GetAllyTeamList
GetTeamList
GetPlayerList
GetTeamStatsHistory
GetAllUnits
GetTeamUnits
GetTeamUnitsSorted
GetTeamUnitsByDefs
GetUnitsInRectangle
GetUnitsInBox
GetUnitsInCylinder
GetUnitsInSphere
GetUnitsInPlanes
GetUnitIsTransporting
GetUnitCommands
GetFactoryCommands
GetCommandQueue
added:
GetAllyTeamList
GetTeamList
GetPlayerList
GetTeamStatsHistory
GetAllUnits
GetTeamUnits
GetTeamUnitsSorted
GetTeamUnitsByDefs
GetUnitsInRectangle
GetUnitsInBox
GetUnitsInCylinder
GetUnitsInSphere
GetUnitsInPlanes
GetUnitIsTransporting
GetUnitCommands
GetFactoryCommands
GetCommandQueue
removed:
GetSelectedUnitsSorted
GetSelectedUnitsCounts