defaultproperties with lua?

  • ReallyJustDont
    6th Jul 2020 Member 0 Permalink

    how do i set an element's DefaultProperties (e.g. tmp, ctype) with lua? do i have to write a create function and how would i do that?

  • jacob1
    7th Jul 2020 Developer 0 Permalink
    If you have a static property, you can do
    elem.property(tpt.el.dust.id, "DefaultProperties", {["tmp"]=5})
    This defaults the tmp to 5. Set other properties as needed.

    If you need dynamic properties, use the Create function:
    elem.property(tpt.el.dust.id, "Create", function(i) tpt.parts[i].tmp = math.random(1,10) end)
  • ReallyJustDont
    7th Jul 2020 Member 0 Permalink

    thanks