KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I read this from the manual http://lua-users.org/wiki/GotoStatement I have a similar code block in a loop: while true do if someCond == nil then goto f -- invalid (forward jump into scope of local definition) end local x = 1 -- do something with x ::f:: end This will fail with "...jumps into the scope of local x" But why? if the jump is executed its after any usage of local x - it is not touched anymore - hence "local x" is not required anymore here When i switch local x with just x = 1 (making in global) it works fine. Is that an oversight or an optimization that is missing ? E.g. maybe they always assume that a local var could possible be used after jumping to the label
Tags (comma-separated)
Save Edits
Cancel