Lua How to create custom function that can be used on variables follow up
snippet in lua

Lua How to create custom function that can be used on variables follow up

user1158

function first_letter(str)
  return str:sub(1, 1)
end

local mt = getmetatable("")
mt.__index["first_letter"] = first_letter

local str = "stuff"
print(str:first_letter())