Kind of mess, but make lua script work with C!