Jump to content

Lua's goto statement


Recommended Posts

Hi so I'm trying to use the goto statement here, but I get the error message "= expected near continue", which means, it seems to me, that "goto" was not registered as a statement, but instead as a variable. Am I doing something else wrong? Or is the "goto" statement invalid in the Lua that DST uses?

 

            for k, stage in pairs(inst.components.growable.stages) do
                print('speeding up growth', k, stage, stage.time)
                if not stage.time then goto continue end
                if type(stage.time) == 'function' then
                    local old = stage.time
                    stage.time = function(...) return old(table.unpack{...}) / GrowthMultiplier end
                elseif type(stage.time) == 'number' then
                    stage.time = stage.time / GrowthMultiplier
                end
                ::continue::
            end

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...