Community Forum

Tables in LUA

Forum Overview >> Scripting

CategoryScripting
Created11.08.2023 10:45


Richard Whitehouse (rj_whitehouse) 11.08.2023 10:45
I'm attempting to get the fill level of silos.

I know I can loop through unloading stations using

for _, unloadingStation in pairs(g_currentMission.storageSystem:getUnloadingStations()) do

But I'm having difficulty understanding where this getUnloadingStations function is. Google / Documentation and searching through the codebase seems to come up with nothing.
The reason I'm trying to understand that, is I'm having difficulty getting the target storage information out the table.

Doing
DebugUtil.printTableRecursively(unloadingStation, ' ', 1, 3);

shows
targetStorages :: table: 0x023d68541d38
table: 0x023d68849ce8 :: table: 0x023d68849ce8
lastServerId :: 73
isManuallyReplicated :: true
fillTypes :: table: 0x023d68852958

But doing things like

for id, value in pairs(unloadingStation.targetStorages) do
for _, targetStorage in pairs(unloadingStation.targetStorage:getTargetStorages()) do

etc all seem to fail.


Note: Log in to post. Create a new account here.