r/badcode • • Feb 01 '21

[deleted by user]

[removed]

12 Upvotes

16 comments sorted by

View all comments

Show parent comment

1

u/Mabi19_ Feb 01 '21 edited Feb 05 '21

"features" (I couldn't fit them inside the main comment):

  • I found out Lua has goto statements
  • Everything is stored in global variables
  • Stores the data in Lua code (todos.dat)

    • Code execution ahoy!
  • Dependent on what the garbage collector does (and also partially the OS):

    • If the first file handle doesn't get collected, in some OSes the request to write to the file could be rejected (because it is being read from at the same time)
  • I tried to circumvent the fact that the names "load" and "save" are taken up by functions by using rawset and rawget everywhere (which is kinda slow), but it still trips up on "save"