Problem: Prime Number Generator
Write a Python function that generates prime numbers up to a given limit. The function should take a single parameter limit, which represents the maximum value of the prime numbers to be generated. The function should return a list of all prime numbers up to the limit.
A prime number is a positive integer greater than 1 that has no positive divisors other than 1 and itself. For example, the first few prime numbers are 2, 3, 5, 7, 11, and so on.
Your task is to implement the generate_primes(limit) function that returns a list of all prime numbers up to the given limit.
Example usage:
"""
primes = generate_primes(20)
print(primes)
"""
Output:
"""
[2, 3, 5, 7, 11, 13, 17, 19]
"""
Note:
You can assume that the limit parameter will be a positive integer greater than 1.
Your implementation should use an efficient algorithm to generate prime numbers.