Skip to content

luaL_tolstring and type coersion #339

Answered by zeux
petrihakkinen asked this question in Q&A
Discussion options

You must be logged in to vote

Is it intended that luaL_tolstring converts numbers in the stack to strings

Not really intentional, should be fixed once Schubfach gets enabled - we noticed this during this cleanup.

The number coercion was definitely a mistake. The issue is that it's pretty prevalent, and the compatibility implications aren't fully understood. For example, removing coercion from the API will also remove it from builtin libraries and any host-provided FFI - which seems like a good thing but also may break compatibility. I think Lua 5.4 started making steps towards removing it but our behavior is likely consistent with previous Lua versions atm.

Something I've considered is a separate configuration optio…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@petrihakkinen
Comment options

Answer selected by petrihakkinen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants