Comments (13)
@hishamhm, @daurnimator, @zhaozg
The table
library is almost complete (only table.sort
missing for now). More tests are welcome! However, since pretty much every function in the table
library has to be replaced anyway, we could use the same approach as for the utf8
module, and just use ltablib.c
from the Lua 5.3 sources as is (I'd just have to turn the lua_rawget
/lua_rawset
macros from the c-api
into real functions). On the other hand, the utf8
functions could probably be implemented in pure Lua, too.
What do you think?
from lua-compat-5.3.
Never mind (there is a problem with Lua 5.1 not respecting the __len
metamethod on tables), the table
library stays in pure Lua for now.
from lua-compat-5.3.
Never mind (there is a problem with Lua 5.1 not respecting the __len metamethod on tables), the table library stays in pure Lua for now.
Why does that matter?
You can always check __len
from C...
from lua-compat-5.3.
You can always check __len from C...
But the source code of the table library didn't (or rather our lua_len
implementation for Lua 5.1 didn't). I changed that, so the option of using ltablib.c
from the 5.3 sources is on the table again (no pun intended).
Anyhow, table.sort
in pure Lua is available as well by now.
from lua-compat-5.3.
Well, since parts are already written in C, I don't see a problem in having it either in C or Lua.
Speaking of tests, a crazy idea would be to see how much of the standard Lua test suite for 5.3 one would be able to run in an earlier version using compat :)
from lua-compat-5.3.
Well, since parts are already written in C, I don't see a problem in having it either in C or Lua.
That's the point, I think utf8
could be implemented in pure Lua as well (string packing is another story, though) ...
Is there a reason to prefer Lua code over C code (for the user of compat53)?
from lua-compat-5.3.
@siffiejoe I don't know... Windows users who shudder at the idea of setting up a build environment and compiling C code?
Ah, and pure-Lua might run faster for LuaJIT users, but further tests would be required.
from lua-compat-5.3.
I can imagine people wanting to use pure lua libraries inside a game or framework where they can't load C code...
For my use cases, I don't really care/mind; I mainly use the project for new C functions :P
from lua-compat-5.3.
Most table functions aren't compiled in LuaJIT anyway, so I've added ltablib.c
from the Lua 5.3 sources as a C module. I'll keep the pure Lua code as a fallback in case loading the C module fails.
(I think users of a game or a framework are stuck with one specific Lua version most of the time, so a compatibility module makes no sense for them ...)
from lua-compat-5.3.
(I think users of a game or a framework are stuck with one specific Lua version most of the time, so a compatibility module makes no sense for them ...)
I was imagining someone wanting to use a general pure lua module (e.g. luatz), that might be written against new apis (e.g. table.move): the user might be stuck on lua5.1, so they load compat-5.3 first?
from lua-compat-5.3.
Point taken.
from lua-compat-5.3.
We now have string packing as a binary module, so I'll leave the binary utf8 module alone as well.
Running the Lua 5.3 test suite proves to be rather complicated: I had to disable test code with integer division operators, bit operators, large integers, and utf-8 escape sequences. The table
, utf8
, and string packing functions pass the remaining tests, but those are the pieces that I took from the Lua 5.3 sources almost unmodified. Testing the rest this way is too much work for me at the moment ...
I think I'm done for now, so I'll change to a more reactive mode of development.
from lua-compat-5.3.
@siffiejoe wow, awesome!! I guess this means it's time to tag it 0.1 and announce it to lua-l, then. Will you do the honors? :)
from lua-compat-5.3.
Related Issues (20)
- luaL_Stream
- LUAERRGCM missing HOT 1
- luaL_loadbufferx HOT 1
- Problems with detection of strerror_r HOT 3
- lua_getuservalue should return type HOT 2
- lua_tointegerx accepts non-integers HOT 5
- Build fail with x86_64-w64-mingw32-gcc on MacOS HOT 1
- luaossl installation fails on alpine docker image HOT 8
- src/compat-5.3.c:59:9: error: implicit declaration of function 'strerror_r' [-Werror=implicit-function-declaration]
- src/compat-5.3.c:451:42: error: initializer element is not computable at load time [-Werror=pedantic] HOT 2
- luaL_typeerror HOT 4
- How to compile on windows HOT 4
- Lua 5.4 HOT 11
- Tests fail on 32bit systems HOT 18
- table.maxn HOT 2
- lprefix.h fails with compilation error HOT 1
- release automation HOT 3
- installing compat-5.3.h by luarocks HOT 1
- Compiling on windows (through luarocks) fails, it thinks my system is POSIX HOT 10
- Unable to install from luarocks on Windows: C4047 issue on liolib.c HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lua-compat-5.3.