lua-php-utils icon indicating copy to clipboard operation
lua-php-utils copied to clipboard

另外一个采用C写的 lua-php-utils

Open qiye opened this issue 12 years ago • 5 comments

https://github.com/qiye/lua-php-utils

所支持的函数 均从 PHP C源码移植过来. 新函数将会不断增加

qiye avatar Oct 14 '13 07:10 qiye

@qiye It is highly recommended to use LuaJIT's FFI to expose such APIs because use of lua_CFunction will prohibit JIT compiling in LuaJIT. I'm already rewriting ngx_lua's existing CFunction-based Lua API with FFI in my lua-resty-core library:

https://github.com/agentzh/lua-resty-core

I appreciate your work but please be careful with the terms used by PHP's copyright license ;)

agentzh avatar Oct 14 '13 20:10 agentzh

Thanks for your advice. I will add PHP's copyright license in my code. If I have time I will be transplanted some String And DIR And FILE PHP function into the ngx_lua project

qiye avatar Oct 16 '13 15:10 qiye

@qiye That's good :)

agentzh avatar Oct 16 '13 20:10 agentzh

Hi there, I am using the function ip2long, sometimes it works and sometimes it throws an error: "attempt to redefine 'in_addr'"

I saw that you answered someone in the past about this issue but I was unable to implement your answer. Could you please elaborate on how to implement:

local C = ffi.C if pcall(function () return C.inet_aton end) then -- inet_aton defined else -- inet_aton not defined end

yairneumann11 avatar Dec 31 '13 09:12 yairneumann11

@yairneumann11 You can see a real-world example in my resty.core.base module: https://github.com/agentzh/lua-resty-core/blob/master/lib/resty/core/base.lua

agentzh avatar Jan 01 '14 19:01 agentzh