Jump to content




apis and disk menus


  • You cannot reply to this topic
3 replies to this topic

#1 makerimages

  • Members
  • 236 posts

Posted 13 August 2012 - 07:53 AM

hi, i have a disk that has a api and startup in the main dir.

api looks like this
function inMenu(menu)
term.setCursorPos(1,1)
print("Would you like to Install makerOS?")
term.setCursorPos(1,9)
write("Selection: ")
end
function selection()
print("1. Yes")
print("2. No")
term.setCursorPos(11,9)
end

and startup looks like this:


term.clear(menu)
textutils.slowPrint("-----------",10)
term.clear()
print("Dear user, welcome to the installation process of makerOS!")
sleep(5)
print("You will now bw guided trough the installation process of your brand new makerOS release!")
sleep(5)
term.clear()
os.loadAPI("/disk/installmenu")
inMenu()
selection()
local input = read() 
if input == "1" then 
os.reboot()
elseif input == "2" then
print("Installation cancelled by user,rebooting")
os.reboot()
else
  print("Invalid selection, please try again")
  sleep(1)
  os.reboot() 
end

its supposed to display text and a menu but it gives me this errorafter showing the text: startup:10 attempt to call nil.

how do i get this working??

#2 ardera

  • Members
  • 503 posts
  • LocationGermany

Posted 13 August 2012 - 09:02 AM

because the functions inMenu() and selection() aren't included in the _G table, they are included in the _G.installmenu table, so you have to use
installmenu.inMenu() and installmenu.selection()

#3 makerimages

  • Members
  • 236 posts

Posted 13 August 2012 - 09:09 AM

how stupid of me... that worked. thanks

#4 ardera

  • Members
  • 503 posts
  • LocationGermany

Posted 13 August 2012 - 09:58 AM

np :P/>





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users