lua-users home
lua-l archive

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


Suppose I have a function:

float sum(float* f) {
  float ans = 0; for(int i = 0; i < 10; ++i) ans += f[i]; return ans;
}

float* get_raw(std::vector<float>& v) {
  return &(v[0]);
}

I can register this function in LuaBind via:

.def("sum", &sum);
.def("get_raw", &get_raw);

Question is -- how do I register the "float*" type? ... i.e. in lua, when I do:

sum(get_raw(some_float_vector))

I get back an error of "using unregistered type" -- what type am I
supposed to register to have luabind recognize the float*?

Thanks!