Files
HyperionOS/Src/Hyperion-kernel/data/lib/modules/hyperion/70_stdlibadv.kmod
T
2026-07-28 20:13:50 -04:00

43 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)
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
break
end
end
end
return str
end