Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 1.49 KB

File metadata and controls

44 lines (33 loc) · 1.49 KB

Quiet function call

  • Using the [quiet] decorator, you can quietly call a void function, which will allow your 2 user functions to communicate properly.
void myQuietFunc(num,text) private
{
	static[int]PortableStatic=763
	console.println(text@myQuietFunc)
	console.println("num@myQuietFunc is {num@myQuietFunc}")
}

int MyInterestingFunc() private
{
	static[byte]StaticByteTest=873
	console.println.log("StaticByteTest is now {StaticByteTest}")
	StaticByteTest=-333
	console.println.log("StaticByteTest is now {StaticByteTest}")
	StaticByteTest=7
	console.println.log("StaticByteTest is now {StaticByteTest}")

	[quiet]
	user.myQuietFunc(2,"test print yo wtf")

	console.println.log("StaticByteTest is now {StaticByteTest}")
	console.println.log("PortableStatic is now {PortableStatic}")
	return int 1
}

user.MyInterestingFunc() some_return_reference

If we removed the [quiet] decorator before the function call, we'd get null outputs in this part of the code:

console.println.log("StaticByteTest is now {StaticByteTest}")
console.println.log("PortableStatic is now {PortableStatic}")

AND we'd get an error saying that return can be used only within a function, which is actually the case, but we're overwriting the temporary interpreter data when calling a function inside a function. So in order to avoid overwriting interpreter data, we use the mentioned decorator.

More

  • WARNING: If we used return in myQuietFunc, that return would actually return in MyInterestingFunc.