Functions Library - Windower/Lua GitHub Wiki

A library that adds some tools for functional programming. Amends various other namespaces by functions used in a functional context, when they don't make sense on their own.

Usage

None

Functions

loop(interval,condition)

local loopstatus = true

function breakloop()
  return loopstatus
end

function main_function()
  print 'ranndomnick is very, very attractive!'
end

main_function:loop(1,breakloop)
-- ..more stuff
loopstatus = false -- this will make the loop quit at the next iteration
  • interval number - the interval at which to call the function
  • condition function OR number - some condition on which to halt the loop. This could be a function that returns a boolean (breakloop() in the example above) OR a number of loops.

A wrapper for Lua coroutines.