bye
Scripts
Script for do
Script for do
1

function say_(id, text) 	if string.sub(text,1,4) == "!off" then 		-- Do something 		return false 	elseif string.sub(text,1,3) == "!on" then 		-- Do something 		return true 	end end
addhook("say","_s")
function _s(id,t)
	if t == "!off" then
		bool = false
	elseif t == "!on" then
		bool = true
	end
end
GeoB99's and
Rainoth's.addhook("say", "sayhook")
function sayhook(id, message)
	if (message == "!off" or message == "!on") then
		boolean = message == "!on"
	end
end
Dousea: Ooooh. I was aware of a similar method for writing an IF but not like how you did. You're incorporating an 'if' while assigning a value to 'boolean'. Daaam. I learned sth new today.
Dousea has writtenaddhook("say", "sayhook")
function sayhook(id, message)
	if (message == "!off" or message == "!on") then
		boolean = message == "!on"
	end
end
Nekomata: well, he's comparing the message just like you do in an if. An if always returns either 'true' or 'false' values (not in text of course) and then he assigns the boolean to be the result of the if
boolean = message == "!on"
Nekomata: Well message must be either "!on" or "!off" because of message == "!off" or message == "!on" condition. boolean must be the value of message == "!on" comparison. boolean must be either true or false based on the comparison.
Dousea: that's a damn smartass if-condition
VADemon: Are you praising or insulting
? About the string.lower, put it under line 3.message = message:lower()
Nekomata has written
Dousea has writtenaddhook("say", "sayhook")
function sayhook(id, message)
	if (message == "!off" or message == "!on") then
		boolean = message == "!on"
	end
end

Dousea: Oh, wow that's something new for me. Though I haven't learn many things in Lua, this trick actually intrigued me. 
GeoB99: I thought everyone knows it. It just uses logic.
print((type({1,2,3}) == "string") and "this is a string") or "this is not a string" ) -- Prints "this is not a string"
print((type("Hello") == "string") and "this is a string") or "this is not a string" ) -- Prints "this is a string"
Re: Script for do
_Yank: print(type({1, 2, 3}) == "string" and "this is a string" or "this is not a string")
print(type("string") == "string" and "this is a string" or "this is not a string")
print("This is " .. type("") == "string" and "" or "not" .. " a string!") -- Wrong!
print("This is " .. (type("") == "string" and "" or "not") .. " a string!") -- Right!
1
