Skip to content

Comment on Write a program that makes 2 + 2 = 5

Comments

Lua:

    local debug = require "debug" -- in case 5.2
    debug.setmetatable(1, {__tostring=function(n)
      return ("%g"):format(n+1)
    end})

    print(2+2)
Trying to make 2+2==5 evaluate as true is a lot harder. Although Lua lets you define a custom + operator, it's a fallback not an override.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.