-- return 1st `n` chars of the word local start = function(word) return function(n) return word:sub(1, n) end end; -- return 1st half of the word w/ middle char if any local half = function(word) return start(word)(#word / 2) end; -- return true if `word` is palindrome, or false otherwise local function pali(word) return half(word) == half(word:reverse()) end; -- print results print( pali( (...) or "" ) );