Comments (9)
lua_objlen
does indeed push its result on the stack.
As far as I can see, the error here is in the documentation: the phrase "(in Lua >= 5.2)" should be moved to after "userdata".
from lrexlib.
lua_objlen
does indeed push its result on the stack.
Both the Lua 5.1 manual and a simple experiment show that it is not true.
As far as I can see, the error here is in the documentation: the phrase "(in Lua >= 5.2)" should be moved to after "userdata".
Do you mean the feature is not supported for Lua 5.1 ?
from lrexlib.
Sorry, I misread the manual. No, I mean that the feature is not supported for userdata in Lua 5.1. In Lua 5.1 a push should be added to put the length on the stack.
from lrexlib.
Thanks for adding support for userdata in Lua 5.1, and well done for fixing the error message as well!
Looking at your fix, it seems it now won't work on plain tables in Lua 5.1. Wouldn't it be better simply to lift the restriction in the documentation, and call lua_objlen when the argument is a table without a __len metamethod?
Also, please can you not put patches for different purposes into the same commit.
from lrexlib.
Looking at your fix, it seems it now won't work on plain tables in Lua 5.1.
Do you mean that prior to my fix it did work on plain tables in Lua 5.1 ?
Wouldn't it be better simply to lift the restriction in the documentation, and call lua_objlen when the argument is a table without a __len metamethod?
Maybe. Personally I don't need table-subjects such as described above. If you do, please implement it.
from lrexlib.
I meant that it would have worked had you simply added a push. The extra fix is small, so it seems hardly worth not making it just to complicate the documentation and make the behaviour different between Lua 5.1 and 5.2. I'll do it.
from lrexlib.
Fixed. I also noticed that for Lua 5.2 I could use luaL_len
, so the code is now actually slightly shorter than before.
from lrexlib.
I meant that it would have worked had you simply added a push. The extra fix is small, so it seems hardly worth not making it just to complicate the documentation and make the behaviour different between Lua 5.1 and 5.2. I'll do it.
Unfortunately I still fail to understand how the length of the table's array part in Lua 5.1 can meaningfully serve as the length of the subject.
The only case that comes to my mind is the table containing an array of single characters, but it seems to be a very specific case not justifying allowing of a table as the subject.
from lrexlib.
I'm just trying to make the behaviour the same in Lua 5.1 and 5.2, not decide whether it was sensible, but I see I've failed in any case, since now the Lua 5.1 code doesn't look for a __len
metamethod on tables. I've made a change so that it does so.
It would probably have taken less of your time if you'd made this fix, not me!
from lrexlib.
Related Issues (20)
- 2.8.0-1 returns a compilation error HOT 9
- Problem in nginx lua module.
- luarocks install error HOT 2
- PCRE_UTF8 support? HOT 2
- Problem with installing lrexlib-2.8.0-1 PCRE on Windows 10 HOT 1
- build fails using luarocks on centos 6 HOT 9
- Need to install in pure Lua environment HOT 3
- Feature request: support Intel Hyperscan HOT 2
- Compilation errors for PCRE2 binding HOT 2
- undefined symbol: luaopen_rex_pcre HOT 1
- Lrexlib Hello World? HOT 5
- Is there way to change MATCH_LIMIT settings for PCRE? HOT 4
- You may have to install PCRE2 in your system and/or pass PCRE2_DIR or PCRE2_INCDIR to the luarocks command.
- Lua 5.4 HOT 9
- Lua 5.3 error in rex_pcre.so - Symbol not found: _lua_newuserdata HOT 2
- Lua 5.2+ attempt to call a nil value (upvalue 'loadstring') HOT 1
- reference manual is 404. HOT 1
- lrexlib-posix doc/ is not readable by everyone HOT 3
- Cannot compile with luarocks under Windows
- "bad JIT option" when calling jit_compile() HOT 2
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 lrexlib.