Eonblast/Lua
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
master
Could not load branches
Nothing to show
Could not load tags
Nothing to show
{{ refName }}
default
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
-
Clone
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more.
- Open with GitHub Desktop
- Download ZIP
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
This is Lua 5.2 (alpha), released on 23 Nov 2010 with a hack for true count of table and string sizes. as of 06 Jan 2011. THIS IS NOT A STANDARD LUA INSTALLATION. Please go to http://www.lua.org/download.html for that. For installation instructions, license details, and further information about Lua, see doc/readme.html. Use: Use the % operator to retrieve the actual number of elemets in a table that are not 'nil'. t = {'foo', nil, 'bar'} print(%t) Or to get an estimate about how many printable characters a UTF-8 string has. Compare this with #t. Of course, instead of '%' we might want to have a function. Basic direction: git clone git@github.com:Eonblast/Lua.git lua52 cd lua52 sudo make <your os> install src/lua test/len.lua src/lua test/strlen.lua Implementation: The count is updated with every table update and therefore takes no time when called. The diff to Lua 5.2.2.0 alpha can be seen here https://github.com/Eonblast/Lua/compare/Lua_5.2.2.0_alpha_original...master Contact: hd2010@eonblast.com Samples: See test/len.lua and test/strlen.lua All these samples work fine, they are taken from the above files, there are many more. -- # # # # # # # # # # # # # # # # # # # # # # # # # Sparce amd Complete Lists -- # # # # # # # # # # # # # # # # # # # # # # # # # t = { } assert(t, 0) t = { nil, nil } assert(t, 0) t = { nil, nil, nil } assert(t, 0) t = { nil, 'foo', nil } assert(t, 1) t = { nil, nil, 'foo', nil , nil } assert(t, 1) t = { nil, nil, 'too', nil, nil, 'bar', nil, nil } assert(t, 2) -- # # # # # # # # # # # # # # # # # # # # # # # # # t = {} t[1] = 'foo' t[2] = nil t[3] = 'bar' assert(t, 2) t = {} t[1] = 'foo' t[2] = 'too' t[3] = 'bar' assert(t, 3) t = {} t[1] = nil t[2] = nil t[3] = 'bar' assert(t, 1) t = {} t[0] = 'foo' t[1] = 'too' t[2] = 'bar' t[-1] = nil assert(t, 3) -- # # # # # # # # # # # # # # # # # # # # # # # # # UTF-8 String Test Samples -- # # # # # # # # # # # # # # # # # # # # # # # # # assert("", 0) assert(" ", 1) assert("Q", 1) assert("Room", 4) assert("Tür", 3) assert("Dûnedaín", 8) assert("Stößel", 6) assert("Fu∂ark", 6) assert("«∑€®†Ω", 6) assert("黃耀賢 (Yau-Hsien Huang)", 21)
About
Lua 5.2 with true length count for tables
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published