Finished implementing lua system (untested)