I think i can find “Ostheim” with if table.find(trainSpawnsAndLines, tostring(stationName)) but how can i find the Number? if table.find(trainSpawnsAndLines, tostring(stationName)[tostring(selectedLine)]) then but that dont works.
Edit: Would this work?:
if trainSpawnsAndLines[stationName][selectedLine] then
table.find does not work on dictionaries. Documentations say it works on array-like tables. Just check directly if trainSpawnsAndLines[stationName] ~= nil and then you’re good from there.
Assume and let trainSpawnsAndLines be a table that contains an arbitrary amount of numbers as strings:
{"2", "5", "9", "474"}
As you can see, it is array-like. To access the number, simply go for: table.find(trainSpawnsAndLines[stationName], selectedLine)
local trainSpawnsAndLines = {["9"] = "Ostheim"}
local trainSpawnsAndLinesVariable = table.find(trainSpawnsAndLines, tostring(stationName))
if trainSpawnsAndLinesVariable then