Nathan Craddock
582bf5ff91
docs: add more comments to example code in readme
2023-02-17 14:30:08 -07:00
Nathan Craddock
b89b24fbe1
fix: replace @ptrCast() with slice.ptr
...
Removes a TODO comment!
2023-02-16 23:00:13 -07:00
Nathan Craddock
cb5cc359f8
docs: add Lua API links to 5.1 functions
...
This makes it easier to find the full docs on the functions
2023-02-16 22:45:26 -07:00
Nathan Craddock
9b40b9c162
feat: add checkInt() and optInt() to 5.1 api
2023-02-16 22:25:32 -07:00
Nathan Craddock
53fc706744
feat: add objectLen() to 5.1 api
2023-02-15 22:06:59 -07:00
Nathan Craddock
458aced082
feat: add get/setFnEnvironment functions
2023-02-15 21:49:24 -07:00
Nathan Craddock
1bfbc59417
feat: add comparison functions to the 5.1 api
...
Adds equal and lessThan
2023-02-15 21:49:24 -07:00
Nathan Craddock
2beee535e5
feat: add cProtectedCall to lua 5.1 api
...
This function was missed. It doesn't seem horribly useful, but might as
well support it.
2023-02-15 21:05:07 -07:00
Nathan Craddock
edf63862ac
feat: update toUserdata interface
...
Now the function accepts a type so the return value is a typed pointer
rather than an *anyopaque. This makes the function easier to use because
the call site would always be a cast anyway.
2023-02-15 21:03:42 -07:00
Nathan Craddock
a8e6f28d09
docs: rename library to module
...
Just keeping with the times in terminology
2023-02-15 15:43:43 -07:00
Nathan Craddock
13a95f3b2a
fix: update package -> module
...
Updates the code to create a Zig module rather than package for the new
API. This is a 1:1 translation, and it will probably change once the
package manager settles down.
What is the best way to expose a module that requires compiling C code?
Not sure yet.
2023-02-15 15:38:34 -07:00
Nathan Craddock
dfc66bc786
ci: update to Zig master and test on OS matrix
2023-02-15 15:18:47 -07:00
Nathan Craddock
faf426a23f
tests: update to latest Zig master
...
Not yet updated to use as a zig module, but now all the tests pass!
2023-02-15 15:05:53 -07:00
NTBBloodbath
518e26712a
hotfix(lua5.1): Apply patch for CVE-2014-5461
...
See https://github.com/natecraddock/ziglua/issues/2
2023-02-15 13:58:53 -07:00
Deano
79b1bdb0b1
LuaVersion and Options need to be public to allow them to be set
2022-12-08 18:05:59 -07:00
Nathan Craddock
bded27ac26
ci: lock zig version to 0.10.0
2022-12-08 07:34:07 -07:00
Nathan Craddock
b73310068d
docs: update readme and add changelog
2022-10-28 21:32:22 -06:00
Nathan Craddock
bd78cafec1
chore: update Lua 5.1 for Zig 0.10.0
...
A fix was made in the Zig compiler yesterday and now the Lua 5.1 code
can be updated and tested.
2022-10-28 20:35:42 -06:00
Nathan Craddock
ab08ecf5f8
cleanup: rename action and add badge to readme
2022-10-27 21:37:49 -06:00
Nathan Craddock
725ff79b7e
fix: libC linking during Lua step
2022-10-27 21:28:20 -06:00
Nathan Craddock
0836cfa002
ci: add GitHub action for running tests
2022-10-27 21:20:12 -06:00
Nathan Craddock
6841ffbaca
feat: add makefile for running tests
2022-10-27 21:19:19 -06:00
Nathan Craddock
5c843b5cf9
docs: update readme and docs for Zig 0.10.0
2022-10-27 21:02:06 -06:00
Nathan Craddock
6515d4bb45
chore: update for Zig 0.10.0
...
In anticipation for the Zig release coming soon (and the new self-hosted
compiler finally free of bugs that prevented this project from
compiling), this updates the sources for each version of Lua to work in
the new compiler. Mostly trivial changes.
Note that at this point Lua 5.1 doesn't yet compile due to a bug that
was just fixed in Zig, and will be addressed later on.
2022-10-27 21:02:06 -06:00
Nathan Craddock
0874099a17
feat: add ziglua.exportFn to all versions
2022-10-27 20:43:19 -06:00
Nathan Craddock
5129816462
cleanup: format code
2022-10-20 16:45:59 -06:00
Nathan Craddock
932db5cd57
feat: add an option to link as a shared library
...
Fixes the linking code, and adds a new option to the build function to
link Ziglua as a shared library rather than as a static library. This is
for the use case of creating shared modules to require at runtime in
Lua.
2022-10-20 16:45:34 -06:00
Nathan Craddock
942afe836a
feat: restructure and add Lua 5.3, 5.2, and 5.1
...
Restructures the source layout and adds three new versions of Lua.
Documentation is still incomplete at this point, but all four supported
versions are well tested.
2022-10-03 20:24:17 -06:00
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