how do I properly use "alloc" and "free" inside a function? I am trying to return a string using the function, but when I free the allocated memory inside the function it returns random letters and symbols. It works if I don't free the memory in the function, but is this is a bad way?
So for example:
So for example:
Code:
while true
wait 0
if
key_down 80 //P
then
call @getString 0 0@
chatmsg "%s" -256 0@
wait 500
end
end
:getString
alloc 0@ 64
format 0@ "i like pizza"
free 0@
ret 1 0@