lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Aug 17, 2012, at 3:50 AM, steve donovan wrote:

> Alas, writing portable C code to create Lua file objects is hard,
> because of the representation differences between 5.1/5.2/LuaJIT. (I
> once ended up reusing a fair chunk of iolib.c in an extension, and I'm
> sure I wasn't the only one)

It's a bit like the Lua Purity Test.

...
Section 4: Cutting and pasting the Lua source

Have you ever cut&pasted code from liblua into an extension? [5 points]

Have you cut&pasted whole files solely to recreate functionality? [5 points]
...was it lstrlib.c? [10 points]
...was it liolib.c? [5 points]
.......changing *more* than three methods? [10 points]
...was it lcorolib.c? [50 points]

...

Section 7: Binding

Have you created a binding to an existing C or C++ library? [5 points]
...did it duplicate an existing binding? [2 points]
......was it really worth it? [10 points]

Have you written a binding entirely by hand? [5 points, Lua is easy]

Have you written a binding entirely in an FFI run-time descriptor system? [5 points]
...before LuaJIT's ffi.*? [2 points]

Have you written a binding with a tool which generates C code? [5 points]
...and then used a script to modify the output? [5 points]

Have you modified a binding tool? [10 points]

Have you *written* a binding tool? [20 points]
...for C++? [-10 points, there are too damn many]
...to map an existing object system like gobject/objc into Lua? [15 more points if it worked]

...

Section 10: Object systems

Score two points for each inheritance system you've written. Score five points for each time you've earnestly sworn you'll never do it again.

etc

Jay