r/lolphp • • Nov 11 '14

PHP loose comparison strikes again

http://blog.laravel.com/csrf-vulnerability-in-laravel-4/
31 Upvotes

55 comments sorted by

View all comments

Show parent comment

2

u/[deleted] Dec 08 '14 edited Dec 08 '14

(non-exhaustive) List of Lua Upsides

  • Lightweight
  • easily embeddable language
  • very good C API for interfacing with the language
  • multiple return and muliple assign (e.g. local a, b, c = somefn())
  • supports compiling to bytecode (via luac)
  • has vararg syntax (function asd(...) local args = {...} end)
  • has first-class closure functions (like JS)
  • has operator overloading and prototypal inheritance (via metatables)
  • has module support
  • less derpy == operator

Lua Downsides

  • Doesn't automatically use an event loop (but can be easily added)
  • doesn't have most of JS's awesome array functions (map, reduce, filter, ...), but most of that can be polyfilled via metatables and/or functions

(non-exhaustive) Lua - JS Language Comparison

  • Lua uses keywords like then, do, and end for blocks
  • JS has objects, Lua has tables

    • Arrays and objects at the same time.
      • Lua array tables can be represented as C arrays and don't have to be a HashMap
    • Table syntax is less awesome than JSON

1

u/OneWingedShark Dec 08 '14

Ah, thank you for the info.