Change the luacast function so it can cast across swig module.