Files
HyperionOS/Src/Hyperion-kernel/data/lib/modules/hyperion/70_stdlibadv.kmod
T
2026-11-26 21:06:36 -05:00

46 lines
1.1 KiB
Plaintext

--:Minify:--
local kernel = ...
function print(...)
local args = {...}
local output = ""
for i = 1, #args do output = output .. tostring(args[i]) .. "\t" end
output = output:sub(1, -2)
syscall.write(1, output.."\n")
end
function printf(fmt, ...)
local output = string.format(fmt, ...)
syscall.write(1, output.."\n")
end
function printInline(...)
local args = {...}
local output = ""
for i = 1, #args do output = output .. tostring(args[i]) .. "\t" end
output = output:sub(1, -2)
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 ~= "" 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
end