SHOW:
|
|
- or go back to the newest paste.
| 1 | function executeTableFunction(input, funcname, ...) | |
| 2 | if input == nil then | |
| 3 | return nil | |
| 4 | end | |
| 5 | ||
| 6 | for k,v in pairs(input) do | |
| 7 | if (type(v[funcname]) == "function" ) then | |
| 8 | v[funcname](...) | |
| 9 | end | |
| 10 | end | |
| 11 | - | if posArray["Y"] ~= 5.5 or posArray["Z"] ~= 7.5 then |
| 11 | + | |
| 12 | ||
| 13 | function getGleisFromPosX(posArray) | |
| 14 | if os.getComputerLabel() == "Bahnhof1" then | |
| 15 | if posArray["Y"] ~= 5.5 or posArray["Z"] ~= 9.5 then | |
| 16 | - | if posX == -4.5 then return 5 |
| 16 | + | |
| 17 | - | elseif posX == -2.5 then return 4 |
| 17 | + | |
| 18 | - | elseif posX == 1.5 then return 3 |
| 18 | + | |
| 19 | - | elseif posX == 3.5 then return 2 |
| 19 | + | |
| 20 | - | elseif posX == 7.5 then return 1 |
| 20 | + | if posX == -1.5 then return 5 |
| 21 | elseif posX == 0.5 then return 4 | |
| 22 | elseif posX == 4.5 then return 3 | |
| 23 | elseif posX == 6.5 then return 2 | |
| 24 | - | if posArray["Y"] ~= 2.5 or posArray["X"] ~= 2.5 then |
| 24 | + | elseif posX == 10.5 then return 1 |
| 25 | else return "?" | |
| 26 | end | |
| 27 | elseif os.getComputerLabel() == "Bahnhof2" then | |
| 28 | if posArray["X"] ~= 20.5 or posArray["Y"] ~= -1.5 then | |
| 29 | - | if posZ == -2.5 then return 5 |
| 29 | + | |
| 30 | - | elseif posZ == -0.5 then return 4 |
| 30 | + | |
| 31 | - | elseif posZ == 5.5 then return 3 |
| 31 | + | |
| 32 | - | elseif posZ == 7.5 then return 2 |
| 32 | + | |
| 33 | - | elseif posZ == 13.5 then return 1 |
| 33 | + | if posZ == -22.5 then return 5 |
| 34 | elseif posZ == -20.5 then return 4 | |
| 35 | elseif posZ == -14.5 then return 3 | |
| 36 | elseif posZ == -12.5 then return 2 | |
| 37 | elseif posZ == -6.5 then return 1 | |
| 38 | else return "?" | |
| 39 | end | |
| 40 | end | |
| 41 | ||
| 42 | end | |
| 43 | ||
| 44 | function fillMyString(myString, fillCount) | |
| 45 | local length = string.len(myString) | |
| 46 | ||
| 47 | if length > fillCount then | |
| 48 | myString = string.sub(myString, 0, fillCount) .. " " | |
| 49 | elseif length < fillCount then | |
| 50 | for i=length,fillCount do | |
| 51 | myString = myString .. " " | |
| 52 | end | |
| 53 | else | |
| 54 | myString = myString .. " " | |
| 55 | end | |
| 56 | return myString | |
| 57 | end |