Skip to content
Snippets Groups Projects
  • Diego Martínez's avatar
    43019538
    builtin: Fix `print` crashing on nil "holes". · 43019538
    Diego Martínez authored
    The engine implementation of `print` packs the varargs into a
    table and passes the table directly to `table.concat`. If you
    pass any value not supported by `table.concat` (particularly
    `nil`), the server crashes. This is unexpected behavior, as
    `print` is supposed to be able to work with anything.
    
    This patch changes the implementation so it first converts
    all arguments using `tostring`, which fixes the issue and
    makes the custom `print` function compatible with the stock
    Lua behavior.
    43019538
    History
    builtin: Fix `print` crashing on nil "holes".
    Diego Martínez authored
    The engine implementation of `print` packs the varargs into a
    table and passes the table directly to `table.concat`. If you
    pass any value not supported by `table.concat` (particularly
    `nil`), the server crashes. This is unexpected behavior, as
    `print` is supposed to be able to work with anything.
    
    This patch changes the implementation so it first converts
    all arguments using `tostring`, which fixes the issue and
    makes the custom `print` function compatible with the stock
    Lua behavior.
init.lua 1.42 KiB