working on api docs
This commit is contained in:
1 parent
56d8fb2016
commit
38d56ced19
43 files changed
+5669
-618
No files matched your search
@@ -21,22 +21,25 @@ function printInline(...)
|
||||
syscall.write(1, output)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function userinput(fd, helpstr, replacestr, fdo)
|
||||
fd = fd or 0
|
||||
fdo = fdo or 1
|
||||
local str = ""
|
||||
if helpstr then print(helpstr) end
|
||||
while true do
|
||||
local inp = syscall.read(fd)
|
||||
if inp~="" and inp~=nil then
|
||||
if inp~="\n" then
|
||||
if replacestr then
|
||||
syscall.write(fdo, replacestr)
|
||||
else
|
||||
syscall.write(fdo, inp)
|
||||
end
|
||||
str = inp
|
||||
else
|
||||
if inp and inp ~= "" then
|
||||
if inp == "\n" then
|
||||
break
|
||||
end
|
||||
if replacestr then
|
||||
syscall.write(fdo, replacestr)
|
||||
else
|
||||
syscall.write(fdo, inp)
|
||||
end
|
||||
str = str .. inp
|
||||
end
|
||||
end
|
||||
return str
|
||||
|
||||
Reference in new issue
Block a user