Commit Graph

27 Commits

Author SHA1 Message Date
Alex Szpakowski fc4847c69d Update copyright for the new year 2020-01-03 22:40:36 -04:00
Alex Szpakowski cb4b45dcf1 Add Data:getFFIPointer. Similar to Data:getPointer but returns a cdata pointer directly (or nil if the FFI isn't available).
It should be preferred instead of Data:getPointer because the latter uses lightuserdata which can't store more all possible memory addresses on some new arm64 architectures, when LuaJIT is used.
2019-07-20 10:47:58 -03:00
Alex Szpakowski 0752f27bdf Update copyright year for 2019 2019-01-03 21:09:05 -04:00
Bart van Strien e80247c191 Happy new year! 2018-01-03 19:47:35 +01:00
Alex Szpakowski f8c58c54c8 love.math.randomNormal can be JIT-compiled
--HG--
branch : minor
2017-04-01 21:19:19 -03:00
Alex Szpakowski abb72cb813 Happy new year! 🥂
--HG--
branch : minor
2017-01-02 01:28:29 -04:00
Bart van Strien 9f6aa716fa Pass Type to luax_register_type by pointer instead of reference
Since the type is passed to va_start, and apparently that's undefined behaviour if it's a reference.

<Textmode> the best kind of behavior

--HG--
branch : dynamiccore2
2016-11-14 21:51:47 +01:00
Bart van Strien d967a755e5 Make love::Type handle type names
TODO: Fix undefined behaviour in luax_register_type, you can't use a va_list after a reference type

--HG--
branch : dynamiccore2
2016-11-14 21:06:53 +01:00
Bart van Strien 7dd960619d Automatically deduce the type in luax_checktype, luax_getmodule, luax_optmodule and luax_totype
--HG--
branch : dynamiccore2
2016-11-13 17:13:40 +01:00
Bart van Strien c761202486 Build type information on first use (load-time), instead of using a hardcoded list
--HG--
branch : dynamiccore2
2016-11-13 16:38:57 +01:00
Alex Szpakowski 37520bd18b Added Object:release. Calling it is the equivalent of removing all Lua-side references to an object and doing a full garbage collection cycle (thus deleting the object from memory if nothing else in LÖVE's code is referencing it).
Any attempt to call a method on the object after it has been released will result in an error. Object:release() returns true if it was successful, or false if not (if it has already been released previously).

--HG--
branch : minor
2016-10-06 21:59:01 -03:00
Alex Szpakowski a9e10dcadf Fixed RandomGenerator.random crashing if a nil 'self' is passed. (closes issue #1116)
It still doesn't generate a proper error message if a non-RandomGenerator 'self' is used, however.
2016-01-02 21:15:39 -04:00
Alex Szpakowski 46a2e7b85c Happy new year! 🎉 2016-01-01 00:05:06 -04:00
Alex Szpakowski 52b1bd78f2 Implemented LuaJIT FFI versions of love.math.random and RandomGenerator:random. 2015-12-10 12:45:53 -04:00
Alex Szpakowski 2c4e713114 Imported some of the dynamiccore branch from love-experiments:
- Type names for love's Lua objects are specified as an argument to luax_register_type, rather than being statically defined in an array.

- luax_register_type takes a variable number of method array arguments, for registering superclass methods without copying them into the subclass' method array.

Also removed most of the header declarations for wrapper functions.
2015-11-29 20:38:12 -04:00
Bart van Strien 3cb777e2b7 Add basic lua 5.3 support 2015-06-16 10:25:41 +02:00
Alex Szpakowski 2f419c1c83 Replaced most cases of type bits and type name strings in love's Lua wrapper code with type id's.
--HG--
branch : minor
2015-03-01 18:32:41 -04:00
Alex Szpakowski c7b45b3505 Updated copyright for the new year 2014-12-31 19:32:43 -04:00
Alex Szpakowski dfa319e01a Replaced the EXCEPT_GUARD macro for converting love exceptions into Lua errors with the new luax_catchexcept function, which takes lambda function arguments. 2014-06-03 19:27:00 -03:00
Alex Szpakowski d07e31370d Added RandomGenerator:getState and RandomGenerator:setState (resolves issue #831.)
getState returns an implementation-dependent string representing the current state of the RandomGenerator's PRNG. setState sets the PRNG's state to an implementation-dependent string.
2014-02-08 20:28:41 -04:00
Alex Szpakowski 3120a0e650 Goodbye 2013, hello 2014! 2014-01-03 17:28:58 -04:00
Alex Szpakowski 1c8abc74aa Renamed love.math.g/setRandomState and rng:g/setState to love.math.g/setRandomSeed and rng:g/setSeed.
getRandomSeed now always returns the previously set random seed instead of the current (implementation-dependent) random state.
2013-12-01 21:25:27 -04:00
Alex Szpakowski 06f80d5c08 Fixed undefined behaviour when love exceptions are converted into Lua errors (resolves issue #729) 2013-09-05 23:17:29 -03:00
Alex Szpakowski 674ad9247a Added some checks for invalid numbers to love.math.setRandomState
--HG--
branch : RandomGenerator-2
2013-08-04 17:04:52 -03:00
Alex Szpakowski 0447d1e7c5 Changed love.math.randomnormal([mean], stddev) to love.math.randomNormal(stddev, [mean]);
Changed love.math.randomseed(seed) to love.math.setRandomState(state) and love.math.setRandomState(low, high). Added low, high = love.math.getRandomState().

love.math.setRandomState(state) can set the random state to an integer of up to 53 bits, love.math.setRandomState(low, high) can set the random state to a 64 bit integer by using the first argument as the lower 32 bits and the second argument as the higher 32 bits.
This allows for reliable setting and saving of the state of a RNG.

--HG--
branch : RandomGenerator-2
2013-08-01 18:32:44 -03:00
Alex Szpakowski d98e2cb40c Renamed randnormal to randomnormal
--HG--
branch : math-randobject
2013-04-15 14:57:20 -03:00
Alex Szpakowski 3046981fce Added love.math.newRandomGenerator. Returns a RNG object with its own seed and random methods.
--HG--
branch : math-randobject
2013-04-14 23:02:44 -03:00