findVar method
Tries to find the variable by id,
If no variable is found in this scope, it
searches parent. This continues until the
variable of the same id is found or returns null.
Implementation
LuaObject? findVar(String id) {
Scope? next = this;
while (next != null) {
if (next.vars.containsKey(id)) {
return next.vars[id]!;
}
next = next.parent;
}
// Not found
return null;
}