Wie kann man auf self.fillLevel von einen Anhänger zugreifen?
Ich hab folgenden Skript probiert.
[lua]
fill = {}
print(" loadFill")
function fill.prerequisitesPresent(specializations)
return SpecializationUtil.hasSpecialization(Fillable, specializations);
end;
function fill:mouseEvent(posX, posY, isDown, isUp, button)
end;
function fill:keyEvent(unicode, sym, modifier, isDown)
end;
function fill:update(dt)
local Level = self.fillLevel;
print(" update:"..Level);
if Level ~= nil then
print(" Level:"..Level);
local prozent = Level/self.capacity*100;
if prozent > 0 then
renderText(0.78, 0.84, 0.02, "Joskin Silospace: " .. tostring(math.floor(self.fillLevel-1)) .. " (" .. tostring(math.floor(prozent)) .. " % ) ");
end;
end;
end;
function fill:draw()
end;
addModEventListener(fill);
[/lua]
Ein teil des skrips ist von dem Forum: Füllstandsanzeige für Anhänger
Folgender Fehler kommt:Lua: Error running function: update
C:/Users/Benutzer/Documents/My Games/FarmingSimulator2011/mods/pronar_kipper/fill.lua(17) : attempt to concatenate local 'Level' (a nil value)