Unfortunately that undefined behavior (if it is one, didn't find the standard citation) is pretty possible because the function is Lua-exported. Should we fix this by using an `int` for an argument instead?