Arrays and Function Inputs

As I learn Pulp, I find that it’s rather difficult to create modular, easy to add/edit functions that are used on a wider scale. Having arrays to store wider ranges of data with less clutter in the code would be a godsent, especially as it would, say, allow a long series of coordinate-based commands to execute in completely different places just by editing the variable the commands use as a key, or create an easy to implement lists- not to mention opening the possibility for things such as iterative commands.

Giving functions (or calls, as Pulp refers to them) optional spots for input would also help with this, to a lesser extent- allowing the input of variables in a call, which the function could then use, would make it much easier to use one function in multiple places while still storing each value (instead of overriding it with the next value needed for a different call of the same function).

Neither are strictly needed to do things you can’t currently, but as an optimization/time-saving measure, having access to arrays and/or function inputs would make things a lot easier for my java-centric mind.

Note: I’m also new to this, I might be wrong.

I think the big thing about this system is it’s synchronous. You won’t be reading a variable twice in a row and getting a different value each time. So you can set a specific return variable and it’ll be the correct value, at least immediately after the function returns. If you also set some variables to be parameters for a function, you can know they will be correct at the start of the function (I would assign them to another variable so that you can reuse them as parameters inside the child function).

// param1 and param2 are global parameter variables
// result is a global return value

param1 = 5
param2 = 3
tell to
  call "remainder"

// Then in the game script
on remainder do
	// param1, param2, result
	a = param1
	b = param2
	// a % b = a - (b * floor(a / b))
	r = a
	r /= b
	r = floor r
	r *= b
	result = a
	result -= r