Hey,
meine Frage wäre, ob es einen besseren Weg alle Werte einer Tabelle für eine Funktion zu nutzen gäbe als dauerhaft "if" zu benutzen.
z.B.:
Lua
-- createColPolygon ( float fX, float fY, float fX1, float fY1, float fX2, float fY2, float fX3, float fY3, ... )
local tablewithvariablinglength = { { 25, 213 }, { 123, 123 }, { 23, 321 }, { 123, 513 } ... }
if tablewithvariablinglength[1] then
if tablewithvariablinglength[2] then
if tablewithvariablinglength[3] then
if tablewithvariablinglength[4] then
if tablewithvariablinglength[5] then
if tablewithvariablinglength[6] then
if tablewithvariablinglength[7] then
createColPolygon ( 1, 5, ... )
else
createColPolygon ( 1, 5, ... )
end
...
Alles anzeigen
Die Tabellenlänge ist variabel, da sie immer wieder neu befüllt wird.
Gibt es eine schöne Methode als dieses dauerhafte if-else?
Mir gefällt dieses dauerhaft if-else nicht.
Da die Tabelle auch mal 30 Einträge haben kann, müsste ich da 30 if-else reinpacken, was total mies aussieht.