Commit Graph

5 Commits

Author SHA1 Message Date
Derek Bailey 061d61f3f8
Lua Generator using IR. (#6940)
* initial hack to get new Lua generator into flatc

* Starting to output enum defs for Lua

* Continue to work on table generation for Lua

* Finished basic getter access for Lua

* Added ability to get object by index

* Finished struct builder

* aliased reflection to r

* finish table builder generation

* register requiring files

* better generated header info

* Tying up loose ends

* Updated reflection to handle struct padding

* Addd type sizes to reflection

* Fixed some vector indirect issues

* Lua tests passed

* Misc cleanup

* ci fixes 1

* ci fixes 2

* renaming

* up size of type sizes

* manually ran clang-format-11 -i src/idl_parser.cpp

* fixed some windows casting

* remove stupid auto import

* more static_casting

* remove std

* update other build environments

* remove scoped enums

* replaced std::to_string with NumToString

* more win fixes

* more win fixes

* replaced old lua with new

* removed auto import

* review responses

* more style fixes

* refactor bfbs_gen_len to use code +=

* added consts

* fix lambda capture for windows

* remove unused return type
2021-12-02 21:29:19 -08:00
Derek Bailey 82aed82b84
Added support for Lua 5.1, 5.2 and 5.4 (#6606)
This adds basic support for different Lua versions.

For Lua 5.2 and Lua 5.3, both the Bit32 and Compat53 Lua modules must be
installed for it to work. You can typically get these on Linux using

apt install lua-compat53 lua-bit32

For Lua 5.4, it should work as is, as it is a clean superset of Lua 5.3,
which is what the original Lua Flatbuffers supported.
2021-05-05 16:36:49 -07:00
Derek Bailey a27c7d8093
Fixed LuaJIT when not compiled with COMPAT mode (#6605)
LuaJIT as installed by apt doesn't include the COMPAT mode for using
Lua5.2 features. So this change just makes the flatbuffer code use a
common implementation.
2021-05-03 11:35:49 -07:00
罗泽轩 d3cd78a87c
[Lua] Add LuaJIT support (#6584)
* [Lua] Add LuaJIT support

Here is the output of LuaTest.sh:

Run with LuaJIT:
built 100 512-byte flatbuffers in 0.16sec: 0.63/msec, 0.31MB/sec
built 1000 512-byte flatbuffers in 0.08sec: 12.06/msec, 5.89MB/sec
built 10000 512-byte flatbuffers in 0.80sec: 12.44/msec, 6.07MB/sec
built 10000 512-byte flatbuffers in 0.33sec: 30.58/msec, 14.93MB/sec
traversed 100 592-byte flatbuffers in 0.04sec: 2.51/msec, 1.42MB/sec
traversed 1000 592-byte flatbuffers in 0.03sec: 31.52/msec, 17.79MB/sec
traversed 10000 592-byte flatbuffers in 0.21sec: 48.77/msec, 27.53MB/sec
Run with Lua 5.3:
built 100 512-byte flatbuffers in 0.02sec: 5.44/msec, 2.66MB/sec
built 1000 512-byte flatbuffers in 0.17sec: 5.74/msec, 2.80MB/sec
built 10000 512-byte flatbuffers in 1.75sec: 5.72/msec, 2.79MB/sec
built 10000 512-byte flatbuffers in 1.38sec: 7.26/msec, 3.55MB/sec
traversed 100 592-byte flatbuffers in 0.00sec: 27.64/msec, 15.60MB/sec
traversed 1000 592-byte flatbuffers in 0.03sec: 30.46/msec, 17.20MB/sec
traversed 10000 592-byte flatbuffers in 0.34sec: 29.62/msec, 16.72MB/sec

* [Lua] Better usage description

* update according to the review
2021-04-30 10:38:16 -07:00
Derek Bailey a4e3ad808e Fix for Boolean types (#5379) (#5466)
The packing/unpacking steps for Boolean values was failing because the
code expected numerical values. I overrode the functions for the Boolean
metatable to account for this. I also had to exclude the Boolean
metatable from the GenerateTypes helper function, as that was overriding
the Pack/Unpack functions defined in its metatable.

Added Linux bash script to run Lua tests from the command line.

Bug: google/flatbuffers#5379

Tested: Added Lua tests that were failing and are now fixed with the
code changes.
2019-08-01 10:28:54 -07:00