Commit Graph

38 Commits

Author SHA1 Message Date
Bruce Hill
156d88a020 Switched hash to be stored in an 'int' instead of 'unsigned long long',
so that it interacts consistenly with rawgeti and rawseti in Lua 5.1
api.
2018-05-04 16:59:43 -07:00
Bruce Hill
b06b127ce5 Added __hash method. 2018-04-23 16:44:04 -07:00
Bruce Hill
dec3dc205f Added __missing metamethod and updated tests. 2018-04-23 16:21:47 -07:00
Bruce Hill
9144735dbb More correct version of __ipairs and __pairs when iterating over tables
with holes.
2018-04-23 15:16:49 -07:00
Bruce Hill
86cf46e70b Cleaned up code around Tuples (immutables with unnamed variable numbered
fields) and printing. Also fixed a pernicious off-by-one bug in the hash
function.
2018-04-20 14:31:58 -07:00
Bruce Hill
13283e5ee9 More doc. 2018-03-16 15:29:25 -07:00
Bruce Hill
14a40ce979 Updated doc. 2018-03-16 15:27:58 -07:00
Bruce Hill
0030c0bc4f Misc changes. 2018-03-16 15:05:40 -07:00
Bruce Hill
f4c8b30d51 Updated doc. 2018-02-28 17:19:45 -08:00
Bruce Hill
096973f06d Cleanup/fixes for from_table(). 2018-02-27 13:47:06 -08:00
Bruce Hill
8634549e77 Changed up the API to allow immutable(nil) for tuples and otherwise
handle length a bit differently.
2018-02-15 15:49:42 -08:00
Bruce Hill
69631d8d56 Switched lua_absindex() to lua_gettop() for compatibility with 5.1 2018-02-14 14:22:47 -08:00
Bruce Hill
45d410d00c Fixed some severe memory problems with slightly kludgey code. Classes
now have a weak-keyed __buckets field that maps udata->bucket, and
buckets now get auto-collected by GC. __gc metamethod is now gone.
2018-02-12 21:59:01 -08:00
Bruce Hill
565250d326 Fix for tostring relying on stack indices, and some general cleanup. 2018-02-12 20:44:18 -08:00
Bruce Hill
bd5ed55ebd Fixed some edge case stuff with varargs, and added incremental GC. 2018-02-12 17:16:06 -08:00
Bruce Hill
04c20ab009 Optimizations of instantiation (no longer creates table until
necessary).
2018-02-11 17:22:00 -08:00
Bruce Hill
fa456525df Fixed bug in float hashing logic. 2018-02-11 17:02:58 -08:00
Bruce Hill
df98ddebd0 Optimized the inst constructor a little bit, cleaned up the shared
bucket metatable, and added a shared class metatable that has a helpful
tostring.
2018-02-11 16:45:26 -08:00
Bruce Hill
0f72014571 Added better support for tuple-like immutable tables. Updated docs and
tests.
2018-02-11 14:56:28 -08:00
Bruce Hill
96e1d36f37 Added support for unpack() in lua 5.3, fixed a bug in tostring, and
added is_instance().
2018-02-11 13:41:37 -08:00
Bruce Hill
1b43ee552b Cleaned up argument parsing. 2018-02-10 17:04:43 -08:00
Bruce Hill
4188c2164d Added slightly more error checking. 2018-02-10 16:48:58 -08:00
Bruce Hill
21d8c27e73 Improving hash. 2018-02-10 16:37:26 -08:00
Bruce Hill
e7e59d4b0e Keep tostring on the stack to avoid looking it up multiple times in the
__tostring loop.
2018-02-10 15:56:03 -08:00
Bruce Hill
b58bd5a12e Cleanup and compressing methods/metamethods into the same thing. 2018-02-09 19:03:10 -08:00
Bruce Hill
468b6a83bb Removed dead code. 2018-02-09 18:32:57 -08:00
Bruce Hill
526c5e7373 Fixed Lua 5.1 compatibility with lua_len() and cleaned up makefile so it
doesn't test by default.
2018-02-09 18:29:21 -08:00
Bruce Hill
7cb9ccc223 Added from_table() 2018-02-09 18:21:49 -08:00
Bruce Hill
bf95f0e317 Renamed __field_positions -> __indices 2018-02-09 18:02:28 -08:00
Bruce Hill
0ef2794f2a Fixed #, switched over to __instance_positions, deleted :new(). 2018-02-09 18:01:01 -08:00
Bruce Hill
cd479f05fd Added __ipairs 2018-02-09 17:10:14 -08:00
Bruce Hill
0f15ee34d7 Added default tostring. 2018-02-09 16:46:33 -08:00
Bruce Hill
1da889f65a For now, switching back to __instances instead of HASH_BUCKETS, because
it's cleaner and not *much* slower.
2018-02-09 15:59:22 -08:00
Bruce Hill
5c8d0fd69a Lots of cleanup. Got rid of instances. 2018-02-09 15:57:34 -08:00
Bruce Hill
8e23cf25cc Added compatibility for luajit. 2018-02-09 05:22:27 -08:00
Bruce Hill
83eece29e4 Cleaned up code. 2018-02-09 03:48:44 -08:00
Bruce Hill
5074828c3d Added conditional compilation so it works for Lua 5.1, 5.2, 5.3 2018-02-09 02:43:58 -08:00
Bruce Hill
9db58c6b8a Initial commit. 2018-02-09 02:13:07 -08:00