diff options
author | Matthias Richter <vrld@vrld.org> | 2012-02-21 14:52:30 +0100 |
---|---|---|
committer | Matthias Richter <vrld@vrld.org> | 2012-02-21 14:52:30 +0100 |
commit | a094675a49cf4ab011ddb15fd1bc21632caceb9c (patch) | |
tree | 8132a17163699fc341d7ab5fa9c0472ef55a80fd | |
parent | 77674a48300d92c6fb7db8efd25cda995ff3d060 (diff) | |
download | Quickie-a094675a49cf4ab011ddb15fd1bc21632caceb9c.tar.gz Quickie-a094675a49cf4ab011ddb15fd1bc21632caceb9c.tar.bz2 Quickie-a094675a49cf4ab011ddb15fd1bc21632caceb9c.tar.xz Quickie-a094675a49cf4ab011ddb15fd1bc21632caceb9c.zip |
Better require regexps for submodules
-rw-r--r-- | button.lua | 2 | ||||
-rw-r--r-- | checkbox.lua | 2 | ||||
-rw-r--r-- | core.lua | 4 | ||||
-rw-r--r-- | init.lua | 2 | ||||
-rw-r--r-- | input.lua | 3 | ||||
-rw-r--r-- | label.lua | 2 | ||||
-rw-r--r-- | slider.lua | 2 | ||||
-rw-r--r-- | slider2d.lua | 2 |
8 files changed, 10 insertions, 9 deletions
@@ -1,4 +1,4 @@ -local core = require((...):match("^(.+)%.[^%.]+") .. '.core') +local core = require((...):match("(.-)[^%.]+$") .. 'core') -- the widget return function(title, x,y, w,h, draw) diff --git a/checkbox.lua b/checkbox.lua index c5f5fce..306fc8f 100644 --- a/checkbox.lua +++ b/checkbox.lua @@ -1,4 +1,4 @@ -local core = require((...):match("^(.+)%.[^%.]+") .. '.core') +local core = require((...):match("(.-)[^%.]+$") .. 'core') return function(info, x,y, w,h, draw) local id = core.generateID() @@ -1,5 +1,6 @@ -- state local context = {maxid = 0} +local draw_items = {n = 0} local NO_WIDGET = function()end local function generateID() @@ -87,7 +88,6 @@ local function save_unpack(t, i) return t[i], save_unpack(t, i+1) end -local draw_items = {n = 0} local function registerDraw(id, f, ...) assert(type(f) == 'function' or (getmetatable(f) or {}).__call, 'Drawing function is not a callable type!') @@ -141,7 +141,7 @@ return { hasKeyFocus = hasKeyFocus, makeTabable = makeTabable, - style = require((...):match("^(.+)%.[^%.]+") .. '.style-default'), + style = require((...):match("(.-)[^%.]+$") .. '.style-default'), color = color, registerDraw = registerDraw, draw = draw, @@ -1,4 +1,4 @@ -local BASE = (...) .. '.' +local BASE = ((...):match('(.+)%.') or ...) .. '.' return { core = require(BASE .. 'core'), @@ -1,4 +1,4 @@ -local core = require((...):match("^(.+)%.[^%.]+") .. '.core') +local core = require((...):match("(.-)[^%.]+$") .. 'core') return function(info, x,y,w,h, draw) info.text = info.text or "" @@ -10,6 +10,7 @@ return function(info, x,y,w,h, draw) if core.isActive(id) then core.setKeyFocus(id) end core.registerDraw(id, draw or core.style.Input, info.text, info.cursor, x,y,w,h) + if not core.hasKeyFocus(id) then return false end local changed = false -- editing @@ -1,4 +1,4 @@ -local core = require((...):match("^(.+)%.[^%.]+") .. '.core') +local core = require((...):match("(.-)[^%.]+$") .. 'core') return function(text, x,y,w,h,align, draw) local id = core.generateID() @@ -1,4 +1,4 @@ -local core = require((...):match("^(.+)%.[^%.]+") .. '.core') +local core = require((...):match("(.-)[^%.]+$") .. 'core') return function(info, x,y,w,h, draw) assert(type(info) == 'table' and info.value, "Incomplete slider value info") diff --git a/slider2d.lua b/slider2d.lua index 023d16f..f20a05b 100644 --- a/slider2d.lua +++ b/slider2d.lua @@ -1,4 +1,4 @@ -local core = require((...):match("^(.+)%.[^%.]+") .. '.core') +local core = require((...):match("(.-)[^%.]+$") .. 'core') return function(info, x,y,w,h, draw) assert(type(info) == 'table' and type(info.value) == "table", "Incomplete slider value info") |