aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2013-09-09 22:23:23 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2013-09-09 22:23:23 -0400
commitab270f6797d4a974c0b25167c78482cb818a0e07 (patch)
treed6c6e1b6929d21d2d42e373916b5dcfc34ca7f5b /core
parent7e88330753edcf2df034e2240c2e77e1006d2e64 (diff)
downloadtextadept-ab270f6797d4a974c0b25167c78482cb818a0e07.tar.gz
textadept-ab270f6797d4a974c0b25167c78482cb818a0e07.zip
Use `events.ARG_NONE` constant instead of string.
Diffstat (limited to 'core')
-rw-r--r--core/args.lua11
-rw-r--r--core/init.lua5
2 files changed, 9 insertions, 7 deletions
diff --git a/core/args.lua b/core/args.lua
index bbf4a074..d5712a42 100644
--- a/core/args.lua
+++ b/core/args.lua
@@ -8,10 +8,12 @@ local M = {}
--
-- ## Arg Events
--
--- + `'arg_none'`
+-- @field _G.events.ARG_NONE (string)
-- Emitted when no command line arguments are passed to Textadept on startup.
module('args')]]
+events.ARG_NONE = 'arg_none'
+
-- Contains registered command line switches.
-- @class table
-- @name switches
@@ -38,7 +40,7 @@ end
-- Processes command line argument table *arg*, handling switches previously
-- defined using `args.register()` and treating unrecognized arguments as
-- filenames to open.
--- Emits an `'arg_none'` event when no arguments are present.
+-- Emits an `ARG_NONE` event when no arguments are present.
-- @param arg Argument table.
-- @see register
-- @see events
@@ -65,7 +67,7 @@ function M.process(arg)
end
i = i + 1
end
- if no_args then events.emit('arg_none') end
+ if no_args then events.emit(events.ARG_NONE) end
end
-- Shows all registered command line switches on the command line.
@@ -103,4 +105,7 @@ _G._USERHOME = userhome
M.register('-u', '--userhome', 1, function() end, 'Sets alternate _USERHOME')
M.register('-f', '--force', 0, function() end, 'Forces unique instance')
+events.connect(events.INITIALIZED,
+ function() if arg then M.process(arg) end end)
+
return M
diff --git a/core/init.lua b/core/init.lua
index d272281e..47e2677f 100644
--- a/core/init.lua
+++ b/core/init.lua
@@ -5,9 +5,9 @@ _RELEASE = "Textadept 7.0 beta 3"
package.path = _HOME..'/core/?.lua;'..package.path
_SCINTILLA = require('iface')
-args = require('args')
_L = require('locale')
events = require('events')
+args = require('args')
require('file_io')
require('lfs_ext')
require('ui')
@@ -17,9 +17,6 @@ _M = {} -- language modules table
-- LuaJIT compatibility.
if jit then module, package.searchers, bit32 = nil, package.loaders, bit end
-events.connect(events.INITIALIZED,
- function() if arg then args.process(arg) end end)
-
--[[ This comment is for LuaDoc.
---
-- Extends Lua's _G table to provide extra functions and fields for Textadept.