Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Import Macro Repair
Panel
bgColor#ffffff
titleQ

Is there a possibility to program a kind of "state machine" via functions?

Panel
bgColor#ffffff
titleA

Like variables also functions are handled internally as tables. A function thus has a name and a value. This value can be changed during runtime and hence decide which function will be called next.

Example code:


if myfunc then
  myfunc()
else
  -- defining all subfunctions
  function my_state_init_done()
    ..
    myfunc = my_state_1
  end
  function my_state_1()
    ..
    myfunc = my_state_2
  end
  function my_state_2()
    ..
    myfunc = my_state_init_done
  end
  myfunc = my_state_init_done
end
Panel
bgColor#ffffff
titleSee also...

Filter by label (Content by label)
showLabelsfalse
spaces@self
showSpacefalse
operatorAND
cqllabel = "netscript" and label = "function" and space = currentSpace ( )
labelsnetscript function