모듈:연습장/배우는사람/Bananas: 두 판 사이의 차이

내용 삭제됨 내용 추가됨
편집 요약 없음
편집 요약 없음
1번째 줄:
local p = {}
 
 
-----------------------------------------------------------------------------------------------------------
function p._getParameters(frame_args, arg_list)
local new_args = {};
local index = 1;
local value;
 
for i, arg in ipairs(arg_list) do
value = frame_args[arg]
if value == nil then
value = frame_args[index]
index = index +1
end
new_args[arg] = value;
end
 
return new_args;
end
 
--[[
Helper function that populates the argument list given that user may need to use a mix of
named and unnamed parameters. This is relevant because named parameters are not
identical to unnamed parameters due to string trimming, and when dealing with strings
we sometimes want to either preserve or remove that whitespace depending on the application.
]]
--function str._getParameters( frame_args, arg_list )
-- local new_args = {};
-- local index = 1;
-- local value;
--
-- for i,arg in ipairs( arg_list ) do
-- value = frame_args[arg]
-- if value == nil then
-- value = frame_args[index];
-- index = index + 1;
-- end
-- new_args[arg] = value;
-- end
--
-- return new_args;
--end
 
-----------------------------------------------------------------------------------------------------------