Adds a new function for wrapping various values to make it easier to
interact with the API. For example, one wrapper accepts a ZigFunction
and returns a Lua.CFunction wrapper around it.
Also adds a test for calling a Zig function from Lua
Adds a test that uses rotate, remove, insert, replace, copy, and
set/getTop to ensure those functions work. Updates a few functions that
couldn't be translated from macros.
Tests pCall and loadString
Perhaps we need a version of pCall with all args default to 0 because
that's kind of annoying.. time will tell if this is common practice.
There is no reason to have both toString() and toLString() when in Zig
we can get the length encoded in the slice type. Perhaps someone in the
future will raise a reason to have a separation with these functions. If
so, it is trivial to bring it back.
This enforces checking the error, and is a much more clean
implementation. This will likely be used for all such functions that can
return a status of LUA_OK or some error.
The api coverage is now complete, in the sense that all identifiers are
listed.
However, only a tiny tiny fraction is actually tested. There are likely
still many bugs to catch, but now we are in a position to fix and refine
this new Zig API.
Nearly there! 93% complete!
There are likely a lot of errors, but getting everything in the library
first makes it easier to write tests and debug as I go.
Again, not yet tested, but added the definitions. Now that all these
functions are done it will be easier to add tests (hard to test these
functions in isolation).
Declare all types in a section to make it easier to find them
Also renames AllocFn -> AllocFunction to make it more consistent with
CFunction (which did not look good as CFn).
Adds Lua.arith for mathematical operations on the stack. Includes a test
where each operator is used at least once. The Zig wrapper uses an enum
to ensure no invalid operators are attempted.
A few other functions are included as needed for testing, but will be
tested individually later on.
Exposes the luaopen_* and luaL_openlibs. Also adds a Ziggified wrapper
function that takes a packed struct as input to specify which libs to
load.
After looking at rlua (a rust lua library) and the lua reference manual,
it seems that these library loading functions have the possibility of
failure. Not sure how to address this yet, but have left a todo.