Commit Graph

127 Commits

Author SHA1 Message Date
Nathan Craddock
a12e3dd676 docs: continue to document functions 2022-09-19 19:49:41 -06:00
Nathan Craddock
e32a8fe790 docs: update doc comments with links to the Lua manual 2022-09-17 14:40:34 -06:00
Nathan Craddock
d8a0e0a110 cleanup: remove comment 2022-09-17 14:21:06 -06:00
Nathan Craddock
c5d14327a7 refactor: pass type to checkUserdata and testUserdata
Rather than pass a string and require an opaque cast, the functions now
accept a Zig type so the string and cast can be done automatically.
2022-09-17 14:19:14 -06:00
Nathan Craddock
150ebe4818 refactor: return a spanned string from typeName 2022-09-17 14:14:57 -06:00
Nathan Craddock
8e6e6f8084 refactor: rename newUserdataUV -> newUserdata
Although Lua 5.4 renamed this function, the old name is fine and more
clear
2022-09-17 14:12:37 -06:00
Nathan Craddock
1479dd9311 refactor: update lua.arith enum with more clear names
Renames idiv -> int_div and unm -> negate for arithmetic operations
2022-09-17 14:10:11 -06:00
Nathan Craddock
09516fddd9 docs: small updates to the docs 2022-09-17 14:06:30 -06:00
Nathan Craddock
0f4faa9a56 tests: add remaining tests
There are a few functions I don't think are worth testing at this point,
so I will consider this to be full test coverage for my purposes!
2022-09-16 23:04:10 -06:00
Nathan Craddock
ec9799b6ca tests: add gsub and loadbuffer tests 2022-09-07 21:00:29 -06:00
Nathan Craddock
6fe8c4908f
tests: add more auxlib tests 2022-07-27 19:11:46 -06:00
Nathan Craddock
f633157537
refactor: replace Error.* with error.*
There isn't a reason to use the full error type everywhere
2022-07-13 20:00:36 -06:00
Nathan Craddock
7650761d9a
tests: add a metatable test 2022-07-13 19:59:23 -06:00
Nathan Craddock
d0d3a95739
refactor: expand gc function into individual functions
While it was cool that Zig metaprogramming could expose all garbage
collection functions with an enum parameter, it's much more
straightforward and clear to just make each a separate function.
2022-07-13 19:45:43 -06:00
Nathan Craddock
c64538dd08
add more Ex variant functions 2022-07-07 21:21:51 -06:00
Nathan Craddock
933be7a576
refactor getGlobal and add getGlobalEx
Adds an extended getGlobal function that returns the type. Both now
return an error when the global is nil.
2022-07-06 19:37:12 -06:00
Nathan Craddock
e06585e9ed
add *Ex variant of pushFString 2022-07-06 19:29:18 -06:00
Nathan Craddock
6be1cbbecc
add *Ex variants of pushString and pushBytes
I never care for the return value of this function, so writing _ = gets
tedious. This adds two new versions that return the value, and the
shorter non *Ex functions return void. This makes the common case
easier, but the option to access the return is still available. This
will be applied to other similar functions in the API.
2022-07-06 19:25:22 -06:00
Nathan Craddock
119e964d13
tests: add auxlib check functions 2022-07-01 19:34:16 -06:00
Nathan Craddock
a70d122a70
tests: add getStack test
This completes the debug library tests!
2022-06-30 19:49:14 -06:00
Nathan Craddock
99904a48d4
tests: test upvalue debug functions 2022-06-29 20:45:53 -06:00
Nathan Craddock
56a823586c
tests: add more debug library tests 2022-06-25 19:38:42 -06:00
Nathan Craddock
737beb71fd
tests: add debug interface test
Tests the getInfo function
2022-06-24 22:54:55 -06:00
Nathan Craddock
0582f77d36
refactor: remove C from pushFunction and pushClosure
It doesn't add any value to mention C
2022-06-19 20:40:23 -06:00
Nathan Craddock
1dfe071dd5
docs: update readme 2022-06-19 11:01:36 -06:00
Nathan Craddock
ab83287ba1
refactor: remove null argument from protectedCallCont 2022-06-19 11:01:08 -06:00
Nathan Craddock
9e4f3dbdf9
cleanup: tidy and remove comments 2022-06-19 10:42:44 -06:00
Nathan Craddock
0b728f9175
refactor: remove toNumberX and toIntegerX
Removes these functions in favor of toNumber and toInteger. These
remaining functions error if the value cannot be returned as a number.

This makes the API safer, while also being a bit more cumbersome. But it
is better to be explicit than use the old toNumber and not know it
returns 0 silently on fail.
2022-06-19 10:35:08 -06:00
Nathan Craddock
5ac473ded2
refactor: rename KContext -> Context 2022-06-18 22:28:22 -06:00
Nathan Craddock
4ce0da4919
docs: update status 2022-06-18 22:25:55 -06:00
Nathan Craddock
8398b38e83
refactor: accept a slice in pushString
Typically the strings pushed are from Zig so the lengths will be known
2022-06-18 22:22:42 -06:00
Nathan Craddock
566d775631
refactor: remove uses of std.mem.span
This can be used by the caller in cases where the length is needed
2022-06-18 22:13:54 -06:00
Nathan Craddock
db41f7582d
refactor: change toString to toBytes
The Lua API has the concept of lstrings (length strings). These are used
when the contents may contain zeroes, or when it is useful to know the
length. Because this data is not necessarily a string, ziglua has
renamed these lstring functions to bytes functions.

The toString function returns a zero-terminated many item pointer which
is useful when you know the data is not zero-terminated.
2022-06-18 22:05:21 -06:00
Nathan Craddock
21de06cb4e
refactor: tidy return values and cleanup TODOs 2022-06-18 21:52:22 -06:00
Nathan Craddock
7e50803c3f
tests: finish main library tests!
The main Lua API library is tested! The tests are very surface level,
but do provide a measure of security against changes now.
2022-06-18 21:24:04 -06:00
Nathan Craddock
07580a1ec4
tests: move tests to a separate source file
The file was getting very long so this makes things a bit more tidy
2022-06-18 16:38:42 -06:00
Nathan Craddock
fc58e1f7d5
tests: add many tests 2022-06-18 16:24:46 -06:00
Nathan Craddock
087033a6d8
tests: add more to table tests 2022-06-18 13:46:05 -06:00
Nathan Craddock
f55b6d5dea
add opaqueCast helper function
Adds a function that makes it a bit neater to cast opaque pointers from
the API.
2022-06-18 13:45:51 -06:00
Nathan Craddock
3f66cf105d
tests: add warning and setWarnF tests
Test that the warning handler works
2022-06-16 21:53:48 -06:00
Nathan Craddock
a027e21e1b
tests: add dump and load test 2022-06-16 21:46:56 -06:00
Nathan Craddock
196d7c7dfb
tests: add status test 2022-06-15 22:04:05 -06:00
Nathan Craddock
a596dc10fc
tests: rawEqual 2022-06-15 21:59:54 -06:00
Nathan Craddock
a9102df0e6
tests: various tests
Value conversion, table access and creation
2022-06-15 21:59:28 -06:00
Nathan Craddock
3157d5c123
tests: add a table access test
Exercises various table functions in the API
2022-06-12 15:23:08 -06:00
Nathan Craddock
09193ca5e6
cleanup: formatting 2022-06-11 22:10:35 -06:00
Nathan Craddock
48d51eb974
tests: add test for len 2022-06-11 22:10:16 -06:00
Nathan Craddock
1f362beafe
tests: add getExtraSpace test 2022-06-11 22:08:08 -06:00
Nathan Craddock
db385a43d3
tests: garbage collection (gc)
Tests the gc function with all of it's variants
2022-06-11 21:48:11 -06:00
Nathan Craddock
d01c34974b
tests: add concat test 2022-06-11 21:08:54 -06:00