1. Hello, i have question, is there more "correct" way to get int value from rust enum? For example i need integer from BuildingGrade.Enum, after some attems i found that tostring returns like "Value: number" so i can keep only numbers like this:
    Code:
    local grade = string.match(tostring(buildingblock.grade),"%d+")
    It worked fine, and do what i want, but i thing there should be some more correct way of this... Any suggestions?
     
  2. The issue with this is that in C# a simple cast to an int would suffice, only problem is that the enums for Lua are tables and all values are considered to be userdata.

    There are a few different ways on how you can approach this but the way you are doing it will do just fine.

    Another approach would be looping the enum table in OnServerInitialized or something and create your own enum table that (enumtable = { "Twigs" = 0, "Wood" = 1, ...... }) and just call that when you need to grab a grade (enumtable[buildingblock.grade:ToString()]).