File: color_random.lua

package info (click to toggle)
minetest-mod-basic-robot-csm 0.0~git20190703.e082c6a-2
  • links: PTS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 268 kB
  • sloc: makefile: 2
file content (13 lines) | stat: -rw-r--r-- 311 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
-- colored chat
if not colors then
	colors = {"red","blue","violet", "lawngreen","brown","yellow","orange","pink"}
end

msg = self.sent_msg()
if msg then
	ret = {};
	for word in string.gmatch(msg,"%S+") do
		ret[#ret+1] = minetest.colorize(colors[math.random(#colors)],word)
	end
	say(table.concat(ret," "))
end