lua2php
A Lua to PHP transpiler.
Usage
CLI
$ yarn add lua2php$ npx lua2php a.lua
Examples
Visit examples.
Implementation
- Table =>
(object)["array"=>[......]]
#a
=>count(a->array)
Different from Lua5.1
- Can only get the length of a continuous array.
- No
loadstring
, metatable, user-defined iterator ... table
,unpack
,tostring
,print
,error
,string
,pairs
,ipairs
cannot be used as normal identifiers.error
can only receive one string argument. Translated tothrow new Exception()
print
can only receive one string argument.string.sub
can only receive one string and two positive integers.- The value of
... and ...
,... or ...
is boolean. - Multiple return or assignment or
for a,b,c in pairs(...)
(c
isnil
) or ... is not supported (except...=unpack(...)
) - No TCO
- The variables captured in closures in the loop are the variables in the last.
for k, v in pairs(...)
. There is no+1
whenk
is a number.
Projects using lua2php
- The Language An experimental programming language.