0
votes

I'm trying to display text on a Lua Canvas in the BizHawk emulator but I keep getting the same error at the line of my 'LuaCanvas.drawText' command.

I haven't found any example scripts for Bizhawk that make use of the canvas

gui.createcanvas(640, 480);
while true do
    LuaCanvas.drawText(100, 100, message);
    emu.frameadvance();
end

The script opens two canvas windows instead of the desired one canvas, and doesn't have the 'message' string that I provided.

Error message reads: NLua.Exceptions.LuaScriptException: [string "main"]:3: attempt to index global 'LuaCanvas' (a nil value)

1
Was the answer helpful? - wp78de

1 Answers

0
votes

I think the code should more look like this.

drawSpace = gui.createcanvas(192,160)
drawSpace.drawBox(5,5,50,50)

or try

local c = gui.createCanvas(60, 60, 300, 200);
c:onPaint = function(params)
  self:clear(1, 0, 0, 1);
  self:moveTo(10, 10);
  self:lineTo(100, 100);
end

Nonetheless, there seems to be a lack of documentation.