NOTE 1: Project evolved into polyfill.lua, Follow me!
NOTE 2: Project only for LuaJIT, If you don't use LuaJIT install luaffi from LuaRocks to use this! :(
Most of Lua functions implementation via C code using LuaJIT's FFI and pure Lua code.
So...You can say that CLua is actually a code booster LOL, And modified version Lua in same time :)
- Fallback intended for who can't use some functions in Lua or LuaJIT!
- Offers techniques for who interested in rewriting functions!
- Portable and fits anywhere LuaJIT or Lua + luaffi can runs!
- Offers deprecated stuff!
The CLua primer can explain some stuff!
NOTE: See documentation and the API for more info!
CLua also introduces simple REPL and command line with following arguments!
-r file -> Runs a file (If you required CLua comment his requiring line)
-e code -> Executes a code
-i -> Runs REPL
-v -> Prints version
-h -> Help (Opens repository page)
NOTE: You can use multiple arguments!
-
No metatable based functions as in
string
andio
modules, The first parameter of each function of them is the file or string itself, Then continue with function parameters! -
ipairs now needs to have 2 parameters by the way to get index of table!
local arr = { 1, 2, 3, 4, 5 }
for i in _C.ipairs(arr, i) do
_C.print("%d", arr[i])
end
- To keep and not overwrite default Lua VM, CLua uses
_C
instead of_G
. - CLua is somehow ready for production but i can't recomment it cause it does not reflect the original Lua API, It's intended to fix problems as CLua introduces fallbacks for them :)
- Some functions are internal so they still use original Lua ones. (And not rewritten!)
- If you get 0 as values for variables created via FFI, See
ctypes.lua
types functions, With using_C.tonumber
and_C.tostring
when needed!
- Better and more pure math functions implementation: Even if not all pure, We could use pure Lua code so it would be better.
- Roberto Ierusalimschy, For "Programming in Lua" book.
- Diego MartĂnez for bitty (I used bnot from bitty).
- Astie Teddy for trace log implementation.
See LICENSE.txt
for bindings license and LICENSES.txt
for third party licenses.