local users = true
local usrlua = io.read()
local disk.isPresent = "bottom"
if users then
shell.setpath(".user/")
else
shell.run(".user/root/usr.lua")
end
io.write("Enter user:R=Root Enter Name user=Not administrator account RB=Reboot")
nuser = io.read()
if nuser == "R" then
shell.run(".user/root/usr.lua")
end
if disk.isPresent then
setMountPath(".D1/")
end
why doesn't it work
https://drive.google.com/file/d/1az6npP32mIhcaT2LuIw8q6d9uzxcZJP2/view?usp=sharing
Quote from: Minetristeru777 on Feb 06, 2025, 01:11 PMlocal disk.isPresent = "bottom"
This is the problematic line — variable names can't have a dot in it.
Did you instead mean something like:
local has_disk = disk.isPresent("bottom")
Quote from: Minetristeru777 on Feb 06, 2025, 01:11 PMlocal disk.isPresent = "bottom"
The code SquidDev provided may help with a solution. Dots are indexing points like from a table. This is for to store a string. Your code tries to store a variable inside a table that doesn't exist. Here's a changed up version of your code to help make it work like you wanted.
-- ORIGINAL CODE MODIFIED WITH HELP --
local users = true
local usrlua = io.read()
local disk_side = "bottom"
local disk_present = (disk.isPresent(disk_side) and not disk.hasAudio(disk_side))
if users then
shell.setpath(".user/")
else
shell.run(".user/root/usr.lua")
end
io.write("Enter user:R=Root Enter Name user=Not administrator account RB=Reboot")
nuser = io.read()
if nuser == "R" then
shell.run(".user/root/usr.lua")
end
if disk_present then
setMountPath(".D1/")
end
In the code I edited above, this should be a more optimized version of what you provided and should help eliminate errors in the script, and a pointer indicating the side to check.
video2 (https://drive.google.com/file/d/1VvXXiYDTpZKNMjkWk4TMmD6MgPv0DFrl/view?usp=drive_link)
video1 (https://drive.google.com/file/d/15AlvP2izpckR24IUoDwj362Njz1htNO1/view?usp=drive_link)
Why Not Working
code 1: video1
local users = true
local usrlua = io.read()
local disk_side = "bottom"
local disk_present = (disk.isPresent(disk_side) and not disk.hasAudio(disk_side))
if users then
shell.setpath(".user/")
else
shell.run(".user/root/usr.lua")
end
io.write("Enter user:R=Root Enter Name user=Not administrator account RB=Reboot")
nuser = io.read()
if nuser == "R" then
shell.run(".user/root/usr.lua")
end
if disk_present then
setMountPath(".D1/")
end
code 2 : video2
shell.run("clear")
print("Loader 1.6")
io.write("Choose enter to:BM=BootMenu B=Bios E=Exit ")
name = io.read()
if name == "BM" then
shell.run("Bios/BootMenu.lua")
else
shell.run("multishell")
end
if name == "B" then
shell.run("Bios/Bios.lua")
else
shell.run("multishell")
end
source code (https://github.com/Minetristeru777/osluasuper-os-7)
Please use the same thread for issues with the same code.
Also, asking for help should go in ask a pro, the programs forum is for showing off complete programs.
Your videos are invalid so I had to test this out in a emulator of mine. You're using io.write which is part of file operation. Here's the code you should be using. I'll be sure to also do a pull request to merge changes to your current source code.
local users = true
local usrlua = "" --io.read wasn't neccesary
local disk_side = "bottom"
local disk_present = (disk.isPresent(disk_side) and not disk.hasAudio(disk_side))
if users then
shell.setPath(".user/") --Function names are case-sensitive. Because you didn't do it right, it said it was an invalid function.
else
shell.run(".user/root/usr.lua")
end
print("Enter user:R=Root Enter Name user=Not administrator account RB=Reboot") -- You're giving a prompt to the user, so utilize the print function instead
nuser = io.read()
if nuser == "R" then
shell.run(".user/root/usr.lua")
end
if disk_present then
setMountPath(".D1/")
end("Enter user:R=Root Enter Name user=Not administrator account RB=Reboot")
nuser = read() --This should be the function you need to be using.
if nuser == "R" then
shell.run(".user/root/usr.lua")
end
if disk_present then
setMountPath(".D1/")
end