Skip to content

Commit

Permalink
Move "easy" input string function things to scripts
Browse files Browse the repository at this point in the history
this was scuffed and is now 1% less scuffed (caused crashing?)
  • Loading branch information
poco0317 committed Feb 20, 2021
1 parent e8f4e3c commit 41344c1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -862,45 +862,6 @@ for i = 2, #ms.SkillSets do
r[#r + 1] = littlebits(i)
end

-- these maybe should be generalized and placed into scripts -mina
function easyInputStringWithParams(question, maxLength, isPassword, f, params)
SCREENMAN:AddNewScreenToTop("ScreenTextEntry")
local settings = {
Question = question,
MaxInputLength = maxLength,
Password = isPassword,
OnOK = function(answer)
f(answer, params)
end
}
SCREENMAN:GetTopScreen():Load(settings)
end

function easyInputStringWithFunction(question, maxLength, isPassword, f)
easyInputStringWithParams(
question,
maxLength,
isPassword,
function(answer, params)
f(answer)
end,
{}
)
end

--Tables are passed by reference right? So the value is tablewithvalue to pass it by ref
function easyInputString(question, maxLength, isPassword, tablewithvalue)
easyInputStringWithParams(
question,
maxLength,
isPassword,
function(answer, params)
tablewithvalue.inputString = answer
end,
{}
)
end

local user
local pass
local profilebuttons =
Expand Down
37 changes: 37 additions & 0 deletions Themes/Til Death/Scripts/12 util.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
function easyInputStringWithParams(question, maxLength, isPassword, f, params)
SCREENMAN:AddNewScreenToTop("ScreenTextEntry")
local settings = {
Question = question,
MaxInputLength = maxLength,
Password = isPassword,
OnOK = function(answer)
f(answer, params)
end
}
SCREENMAN:GetTopScreen():Load(settings)
end

function easyInputStringWithFunction(question, maxLength, isPassword, f)
easyInputStringWithParams(
question,
maxLength,
isPassword,
function(answer, params)
f(answer)
end,
{}
)
end

--Tables are passed by reference right? So the value is tablewithvalue to pass it by ref
function easyInputString(question, maxLength, isPassword, tablewithvalue)
easyInputStringWithParams(
question,
maxLength,
isPassword,
function(answer, params)
tablewithvalue.inputString = answer
end,
{}
)
end

0 comments on commit 41344c1

Please sign in to comment.