ff_envelope.lua (657B)
1 local base = string.match(..., "(.-)[^%.]+%.[^%.]+$") 2 local ffi = require("ffi") 3 local fh = require(base.."helper.ffi_struct") 4 5 local format = string.format 6 7 local mt, index = {}, {} 8 9 fh.gen_raw_accessor(index, "attack_length") 10 fh.gen_raw_accessor(index, "attack_level") 11 fh.gen_raw_accessor(index, "fade_length") 12 fh.gen_raw_accessor(index, "fade_level") 13 14 function index:tostring() 15 return format( 16 "ff_envelope{attack_length=%d, attack_level=%d, fade_length=%d, fade_level=%d}", 17 self.attack_length, self.attack_level, self.fade_length, self.fade_level) 18 end 19 mt.__tostring = index.tostring 20 21 return fh.base(mt, index, ffi.typeof("struct ff_envelope"))