Jump to content

Freeloop - optional argument


KeyWorld

Recommended Posts


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

Hi,

Just a suggestion about freeloop, would be great to add the argument as optional to get back the current value of freeloop.

BUILDIN_FUNC(freeloop) {

	if( script_hasdata(st,2) ) {
		st->freeloop = !!script_getnum(st,2);
	}

	script_pushint(st, st->freeloop);
	return SCRIPT_CMD_SUCCESS;
}

BUILDIN_DEF(freeloop,"?"),

The idea here is to return the value of freeloop without modifying it.

Why exactly ? Just imagine an intensive function you want to build but return to normal state after :

function	script	intensiveFunction	{
	// Save the current value of freeloop
	set .@state, freeloop();

	freeloop(1);

	//dothis;
	//dothat;

	//get back to the original state
	freeloop(.@state);

	return;
}
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

Implemented in de46393.

Link to comment
Share on other sites

×
×
  • Create New...