Any good websites to learn lua?

  • godhydra
    28th Nov 2018 Member 0 Permalink

    I've been playing TPT for a while now and I think being able to create my own elements would open up another dimension for me to be able to create things from scratch. Is there any good websites to learn Lua in order to create these mods.

  • NF
    28th Nov 2018 Member 0 Permalink

    @godhydra (View Post)

     I suggest watching a Youtube video on how to learn Lua, or going to your local library to pick up a book on Lua. 

  • jacob1
    28th Nov 2018 Developer 0 Permalink
    http://www.lua.org/manual/5.2/manual.html
    https://www.lua.org/pil/1.html

    I recommend those. The first is the reference, it contains every single function built into lua. The second is the actual guide, I think it's the official one. It's very helpful sometimes (but I haven't actually used it besides for reference)
  • godhydra
    28th Nov 2018 Member 0 Permalink

    Alright, thanks.

     

    EDIT:

    Oh yeah, I just got done with making an element, but I can't seem to get it to appear in the game. Anything I'm doing wrong?

    local modExp = elements.allocate("HYDRA","EXPT")
    elements.property(elements.HYDRA_PT_EXPT,"Name","EXP1")
    elements.property(elements.HYDRA_PT_EXPT,"Description","An experimental element. Hope it works!")
    elements.property(elements.HYDRA_PT_EXPT,"Color",0x80000)
    elements.property(elements.HYDRA_PT_EXPT,"MenuVisible",1)
    elements.property(elements.HYDRA_PT_EXPT,"MenuSection",SC_SOLIDS)
    elements.property(elements.HYDRA_PT_EXPT,"Diffusion",2)
    elements.property(elements.HYDRA_PT_EXPT,"Falldown",0)
    elements.property(elements.HYDRA_PT_EXPT,"State",ST_SOLID)
    elements.property(elements.HYDRA_PT_EXPT,"Gravity",0)
    elements.property(elements.HYDRA_PT_EXPT,"Flammable",0)
    elements.property(elements.HYDRA_PT_EXPT,"Explosive",0)
    elements.property(elements.HYDRA_PT_EXPT,"Loss",0)
    elements.property(elements.HYDRA_PT_EXPT,"AirLoss",0)
    elements.property(elements.HYDRA_PT_EXPT,"AirDrag",0)
    elements.property(elements.HYDRA_PT_EXPT,"Advection",0)
    elements.property(elements.HYDRA_PT_EXPT,"Weight",100)
    elements.property(elements.HYDRA_PT_EXPT,"Meltable",0)
    elements.property(elements.HYDRA_PT_EXPT,"Hardness",35)
    elements.property(elements.HYDRA_PT_EXPT,"Properties",TYPE_SOLID)
    elements.property(elements.HYDRA_PT_EXPT,"Temperature",273.15)
    elements.property(elements.HYDRA_PT_EXPT,"HeatConduct",30)
    Edited once by godhydra. Last: 28th Nov 2018