Now uses struct constructors and methods in the Lua code.