Cant figure out why my function isn't working

My code for my function looks like this:

function charge(var, messasge_send, looking_message, message_id)
	if message_id == hash(looking_message) then
		points = points - var
		msg.post("shop_opened_GUI", message_send)
	end
end

and when I run the function like this:

charge(item_1_price, "+price1", "item_1_charge", message_id)

it gives me an error that says:

ERROR:SCRIPT: Scene objects/BUTTON/Button_script.script:20: bad argument #2 to ‘post’ (hash expected, got nil)
stack traceback:
[C]:-1 : in function post
Scene objects/BUTTON/Button_script.script:20: in function charge
Scene objects/BUTTON/Button_script.script:30: in function <Scene objects/BUTTON/Button_script.script:24>
I tried doing this:

charge(item_1_price, hash("+price1"), "item_1_charge", message_id)

and:

function charge(var, messasge_send, looking_message, message_id)
	if message_id == hash(looking_message) then
		points = points - var
		msg.post("shop_opened_GUI", hash(message_send))
	end
end

(I do know why the second one doesn’t work.)
So how do I fix argument two to post? it clearly says hash expected so I don’t know how to fix it.

Your parameter name is misspelled!

2 Likes

Oh that’s why thanks