On 26 June 2012 06:21, QuentinC <webmaster@xxxxxxxxxxxx> wrote: > Infortunately, I need the standard round function missing from math table (I > don't understand why they could have missed it in lua 5.1.4 but that's > another topic). So I wrote that, but it doesn't work : > > ffi.cdef[[ double round (double); ]] > function math.round (n) > return ffi.C.round(n) > end > > > When I call this math.round function above, I get an error telling that the > function can't be resolved. > > I have also tried to run this code directly in the interactive interpreter > (luajit.exe), but the result is the same, so the problem don't appear to > come from my host program. > > IN luajit 2.0.0.9, the error message was different: it said something like > "can't resolve, but operation has succeeded". > > What's the problem ? What am I doing wrong ? What should I change to get it > working ? > Thank you very much for your help. > math functions are in the math library. ffi.cdef[[ double round (double); ]] Cmath = ffi.load"m"