Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is using Lua in PHP feasible?

I would like to know whether it is feasible to use Lua code scripts in PHP, for a fairly critical and important web app.

What I would like to do is create scripts for different enviornments, so I don't have to write different PHP code for all of them.

like image 790
Dragunov Avatar asked Jun 23 '26 04:06

Dragunov


2 Answers

Feasible ? Yes. There are packages for that. http://pecl.php.net/package/lua.

Good idea ? I strongly doubt it. What can you do in Lua that you can't in PHP ?

like image 190
user703016 Avatar answered Jun 25 '26 18:06

user703016


The only show-stopper could be the state of development of the used lua extension. I've played around a little bit with the one you can find here:

http://repo.or.cz/w/phplua.git

It seems to be still active developed. I've never used it in production though, because i always wondered if PHP is still the right tool for the backend, if scripting is required. But if you already have the backend developed and just want to add scripting, it's probably a good way to go ...

like image 35
aurora Avatar answered Jun 25 '26 18:06

aurora