refactoring
This commit is contained in:
@@ -50,6 +50,7 @@ do
|
||||
end
|
||||
}
|
||||
public.color.get = color_accessor(function(color)
|
||||
log'kek'
|
||||
local r, g, b, a = unpack(color)
|
||||
return setmetatable({r/255, g/255, b/255, a}, mt)
|
||||
end)
|
||||
|
||||
+2
-2
@@ -81,12 +81,12 @@ function public.modified.get() return IsShiftKeyDown() or IsControlKeyDown() or
|
||||
--end
|
||||
|
||||
do
|
||||
local _state = setmetatable({}, {__mode='kv'})
|
||||
local _state = setmetatable(t, -object('__mode', 'kv'))
|
||||
local __index = function(self, key)
|
||||
return _state[self].handler({public=self, private=_state[self].state}, key)
|
||||
end
|
||||
function public.index_function(state, handler) -- TODO rename table-accessor, use predicate to stop
|
||||
local state, self = {handler=handler, state=state}, {}
|
||||
local state, self = {handler=handler, state=state}, t
|
||||
_state[self] = state
|
||||
return setmetatable(self, {__metatable=false, __index=__index, state=state})
|
||||
end
|
||||
|
||||
+3
-3
@@ -279,7 +279,7 @@ function parse_parameter(input_type, str)
|
||||
end
|
||||
|
||||
function public.parse_query_string(str)
|
||||
local post_filter = {}
|
||||
local post_filter = t
|
||||
local blizzard_filter_parser = blizzard_filter_parser()
|
||||
local parts = map(split(str, '/'), function(part) return strlower(trim(part)) end)
|
||||
|
||||
@@ -533,11 +533,11 @@ function validator(components)
|
||||
if components.blizzard.exact and strlower(info.item(record.item_id).name) ~= components.blizzard.name[2] then
|
||||
return false
|
||||
end
|
||||
local stack = {}
|
||||
local stack = tt
|
||||
for i = getn(components.post), 1, -1 do
|
||||
local type, name, param = unpack(components.post[i])
|
||||
if type == 'operator' then
|
||||
local args = {}
|
||||
local args = tt
|
||||
while (not param or param > 0) and getn(stack) > 0 do
|
||||
tinsert(args, tremove(stack))
|
||||
param = param and param - 1
|
||||
|
||||
@@ -79,7 +79,7 @@ end
|
||||
function public.write_record(schema, record)
|
||||
local separator = schema[2]
|
||||
local parts = tt
|
||||
for i = 3, getn(schema) do
|
||||
for i = 3 , getn(schema) do
|
||||
local key, type = next(schema[i])
|
||||
tinsert(parts, write(type, record[key]))
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user