Skip to content

Lifecycle issue: update() called before setup() upon startup #26

Description

@triss

Bug
update() is called before setup() upon startup. update() should not be called until after setup() has been completed.

To Reproduce

require("L5")

function setup()
	v = 1
end

function update()
	v = v + 1
end

Expected behavior
v should increment.
first setup should be called where v is defined, then update should increment v.

Observed behaviour
Instead we get an error stating v has not been defined.
update() is called before v is defined in setup()

main.lua:8: attempt to perform arithmetic on global 'v' (a nil value)

Traceback

[love "callbacks.lua"]:228: in function 'handler'
main.lua:8: in function 'update'
L5.lua:178: in function 'update'
L5.lua:46: in function <L5.lua:15>
[C]: in function 'xpcall'

Platform:

  • OS: MX Linux
  • L5 Version: 0.1.7/0.1.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions