diff options
author | Solderpunk <solderpunk@sdf.org> | 2018-12-08 14:37:46 +0000 |
---|---|---|
committer | Solderpunk <solderpunk@sdf.org> | 2018-12-08 14:37:46 +0000 |
commit | 8596ef9bc52c62e409b7a971bb3da6614c7988fa (patch) | |
tree | a5a94aced1c8623aeddc652fa4184f3bdd4cb15a | |
parent | General tidy up, get rid of needless global vars, fix bugs from earlier globa... (diff) |
Declare and explain global vars at start of program.
Diffstat (limited to '')
-rwxr-xr-x | telem.lua | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -11,11 +11,17 @@ table = require("table") _BBS_ROOT = "/var/bbs/" - --- TODO: This is, obviously, not secure and will need to be updated -username = os.getenv("USER") - -current_board = "" +-- Global var declarations +-- (Not actually required by Lua, just here to make the design clear/explicit) + +username = os.getenv("USER") -- TODO: This is, obviously, not secure and will need to be updated +boards = {} -- Array of board names, alphaetically sorted +board_names = {} -- Set of board names, must always be consistent with boards +current_board = "" -- String, name of current board, must be in boards and board_names +current_board_threads = {} -- Array of thread tables, containing threads associated with current_board +current_thread = {} -- Active thread table, always an element of current_board_threads +current_thread_posts = {} -- Array of post tables, containing posts associated with current_thread +current_post_index = nil -- Integer index into current_thread_posts function cat_file(filename) io.input(filename) @@ -316,7 +322,6 @@ end show_welcome() -boards, board_names = {}, {} for board in lfs.dir(path.join(_BBS_ROOT, "boards")) do if string.sub(board, 1, 1) ~= "." then boards[board] = true |