completed lua interface to C
changed max_nc to avoid overflow
made Lua side aware of tpsa structure