Life is Feudal: Forest Village Wiki
Advertisement

If you need access to passed game time you can use UpdateManager.

All that you need is create an object with update() function and add it to updateManager:

local object = {}

function object:update(dt)
    -- use dt (delta time from previous frame)
end

fv.core.theUpdateManager:addObject(object)

However, the better programming practice is to create a special class for this (see Classes for details):

MyClass = Class("MyClass")

function MyClass:update(dt)
    -- use dt (delta time from previous frame)
end

local instance = MyClass()
fv.core.theUpdateManager:addObject(instance)

By default, dt is represented game time (in seconds). That is, dt is scaled by time control buttons and always 0 on pause. If you need real delta time for some reason, you need pass true for second parameter of addObject() function:

fv.core.theUpdateManager:addObject(instance, true)
Advertisement