• Print

Author Topic: Why are ULX command callbacks declared inside the ulx namespace?  (Read 3597 times)

0 Members and 1 Guest are viewing this topic.

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
I have been wondering why ULX command callbacks are declared inside the global ulx namespace.

I'm talking about declaring a callback like:
Code: Lua
  1. function ulx.callback( calling_ply )

Instead of using a local function:
Code: Lua
  1. local function callback( calling_ply )

- Is there a particular reason for declaring these callbacks globally?
- Should developers follow this convention when writing modules for ULX?

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Why are ULX command callbacks declared inside the ulx namespace?
« Reply #1 on: April 30, 2016, 09:58:40 am »
By making it non-local, it makes it easier to modify by third-parties, and you are able to call it manually if you need to. There's really no reason to not have it accessible in this manner. You only need to follow our style if you are contributing code to the Ulysses repository.
Experiencing God's grace one day at a time.

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: Why are ULX command callbacks declared inside the ulx namespace?
« Reply #2 on: April 30, 2016, 03:14:28 pm »
OK! Thank you for your answers. :)

  • Print