//New config lua added be Neon.

-- "simple" io for emotes_hide
-- except it ends up looking complicated due to being a bad garuntee
-- feel free to use this as a base for whatever command you want io for in your own addons.

-- load on startup
local load = io.openlocal("client/emotesRedux/emotes_hide.cfg", "r")
print("Loading emotes_hide from file...")
if load != nil then
	local read = load:read("*n")
	if read == nil then -- did we succeed
		print("Not a number! This session will use the default setting.")
	else
		if read < 3 and read >= 0 then
			emotes.clienthide = read
			print("File loaded successfully.")
			--print(read)
		else
			print("Number was retrieved, but was out of range. This session will use the default setting.")
		end
	end
	io.close(load)
else
	-- yeah... idk why i did this.
	print("emotes_hide.cfg was missing or inaccessible, so this must be your first time loading!\nUse the weapon selection keys to emote to other players!\nUse the emotes_hide command to hide emotes yourself if you don't like it.")
end

emotes.savehide = function()
	local file = io.openlocal("client/emotesRedux/emotes_hide.cfg", "w")
	if file == nil then
		print("File NOT saved successfully, please try again, or clear space, or... something.")
	end
	file:write(tostring(emotes.clienthide)) -- put the number in there
	file:flush() -- save
	file:close() -- we are DONE.
	print("File saved.")
end