refactor luaCfunction