Skip to content

luaharfbuzz breaks tostring #49

@deepakjois

Description

@deepakjois

Email from Simon Dales:

When testing I spotted an issue with
tostring().

"Receives a value of any type and converts it to a string in a
human-readable format"[1].


///////////

Run:
//////////////////
for k,v in pairs(luaharfbuzz) do
  print(k,v)
end
//////////////////
Should only fail if your lua, say texlua, hasn't got luaharfbuzz. Else
it should list the elements of the table.

I have a more sophisticated version of this loop that does it
recursively. So your code breaks a recursive list of _G.

//////
I did a couple of versions of the same hack: remove __tostring. Either
subsequently in lua or by commenting out in the sources.

Then the above lua works as the lua manual says it should.

But this breaks the use of tostring in some of your lua code, that
expects the returned string to be an internal value, such as language's
4 letter code.

//////////
2 obvious solutions:
* rename the function, but this probably breaks existing lua code
* fix the __tostring so that it works as the default class behaviour.

Any other better ones?

//////////////////////

[1] https://www.lua.org/manual/5.3/manual.html#pdf-tostring

//////////////////////

Simon

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions