Skip to content

Lua API

Every function is available from require("malvado"). After require("malvado").import_globals() the same functions are flat globals, and the constants such as KEY_ESCAPE and SIGNAL_KILL are installed. This reference lists the flat name and the mv namespace form of each function.

require("malvado").import_globals()
local Player = process(function(self)
while not key(KEY_ESCAPE) do
if key(KEY_LEFT) then self.x = self.x - 4 end
if key(KEY_RIGHT) then self.x = self.x + 4 end
if key(KEY_UP) then self.y = self.y - 4 end
if key(KEY_DOWN) then self.y = self.y + 4 end
frame()
end
end)
start(function() Player({x = 400, y = 300}) end, {title = "Move"})

The functions are grouped below. See the gameplay API guides for the process model, and the concept guides for each area.