refactoring
This commit is contained in:
+12
-7
@@ -117,7 +117,7 @@ do
|
|||||||
local function pseudo_literal(mode)
|
local function pseudo_literal(mode)
|
||||||
local upvals = {setmetatable=setmetatable, setn=table.setn, error=error}
|
local upvals = {setmetatable=setmetatable, setn=table.setn, error=error}
|
||||||
local mt = {__call = pseudo_vararg_function(insert_chunk(mode) .. 'setmetatable(a1, nil); return a1', upvals)}
|
local mt = {__call = pseudo_vararg_function(insert_chunk(mode) .. 'setmetatable(a1, nil); return a1', upvals)}
|
||||||
return function() return setmetatable(acquire_temp(), mt) end
|
return function() return setmetatable(acquire(), mt) end
|
||||||
end
|
end
|
||||||
public.S.get = pseudo_literal'k'
|
public.S.get = pseudo_literal'k'
|
||||||
public.A.get = pseudo_literal'v'
|
public.A.get = pseudo_literal'v'
|
||||||
@@ -125,10 +125,15 @@ do
|
|||||||
public.T.get = pseudo_literal'kv'
|
public.T.get = pseudo_literal'kv'
|
||||||
end
|
end
|
||||||
|
|
||||||
do
|
--do
|
||||||
local body = ''
|
-- local body = ''
|
||||||
for i = 2, 100 do
|
-- for i = 2, 100 do
|
||||||
body = body .. format('if a1 == %d then return %s end;', i, arg_chunk(i, 100))
|
-- body = body .. format('if a1 == %d then return %s end;', i, arg_chunk(i, 100))
|
||||||
end
|
-- end
|
||||||
public.select = pseudo_vararg_function(body)
|
-- public.select = pseudo_vararg_function(body)
|
||||||
|
--end
|
||||||
|
|
||||||
|
function public.select(i, ...) temp=arg
|
||||||
|
while i > 1 do i = i - 1; tremove(arg, i) end
|
||||||
|
return tremove(arg, 1), unpack(arg)
|
||||||
end
|
end
|
||||||
@@ -239,6 +239,7 @@ do
|
|||||||
) do
|
) do
|
||||||
if not self[parser[1]] then
|
if not self[parser[1]] then
|
||||||
tinsert(parser, str)
|
tinsert(parser, str)
|
||||||
|
p(str, p(unpack(parser)), p(select(3, unpack(parser))))
|
||||||
local index, label = parser[2](select(3, unpack(parser)))
|
local index, label = parser[2](select(3, unpack(parser)))
|
||||||
if index then
|
if index then
|
||||||
self[parser[1]] = A(label, index)
|
self[parser[1]] = A(label, index)
|
||||||
|
|||||||
+1
-1
@@ -372,7 +372,7 @@ end
|
|||||||
|
|
||||||
function public.item_class_index(item_class)
|
function public.item_class_index(item_class)
|
||||||
for i, class in temp-A(GetAuctionItemClasses()) do
|
for i, class in temp-A(GetAuctionItemClasses()) do
|
||||||
if item_class == nil then error() end
|
if type(item_class) ~= 'string' then error() end
|
||||||
if strupper(class) == strupper(item_class) then
|
if strupper(class) == strupper(item_class) then
|
||||||
return i, class
|
return i, class
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user