Added missing prototypes.
  Avoid shadowing the "screen" variable.
  Misc fixups.
  Explicitly cast the return of `luaL_checknumber` to int.

  This avoids an implicit conversion