require 'class' str = class("str") function str:__init__(value) self.value = value end function str:__add(b) local value = "" if self.value then value = value .. self.value end if b.value then value = value .. b.value end return str(value) end function str:__str() return self.value end function str:__mod(value) if value.__class__ == tuple then local lua_params = {} for k, v in pairs(value.value) do if type(v) == "table" and v.__class__ == str then table.insert(lua_params, v.value) else table.insert(lua_params, v) end end return str(string.format(self.value, table.unpack(lua_params))) end if value.__class__ == str then return str(string.format(self.value, value.value)) end end