Issues

Issue #772 resolved

Mesh error messages

hahawoo
created an issue
vertices = {
    {0, 0, 0, 0},
    {0, 100, 0, 1},
    {100, 100, 1, 1}
}
image = love.graphics.newImage('image.png')
mesh = love.graphics.newMesh({vertices}, image)

main.lua:7: bad argument #-8 to 'newMesh' (number expected, got table)

vertices = {
    {0, 0, 0, 0},
    {0, 100, 0, 1},
    {100, 100, 1, 1}
}
image = love.graphics.newImage('image.png')
mesh = love.graphics.newMesh(vertices, image)
mesh:setVertex(0, {100, 100, 100, 100})

Invalid vertex index: -1

Expected "Invalid vertex index: 0"

Also why is the line number given in the first error message but not in the second, and why does "Invalid" start with a capital but "bad" does not?

Comments (3)

  1. Alex Szpakowski

    The first error is a type error generated by Lua. The second is an error generated by LÖVE's internal code.

    All of LÖVE's errors are like that. This is nothing new to Meshes. :)

    The negative index with the first error is an unfortunate side effect of the fact that Lua's C API is stack-based combined with type checking in table arguments.

  2. Log in to comment