Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

Valentin Long

Members
  • Content Count

    1
  • Joined

  • Last visited

Posts posted by Valentin Long

  1. im trying to make a small custom Os. i managed to get the BIOS working and now im trying to load libraries to the lua enviroment (OpenOS does the same from my understanding)

    i have a function that iterates over all the files on /lib/core and loads them. however im getting an error that i did not manage to solve. Here is the first part of the function:

    clarification: as im working almost at bios level, i dont have access to some functions like print(). so i use error() to print a message in screen
     

     --loading libraries in /lib/core
      do
        for _, object in pairs(component.invoke(addr, "list", "/lib/core")) do --equivalent to component.filesystem.list("/lib/core") then object becomes a file or directory in /lib/core for each iteration
    
    	  --if i call error(object) at this point the message reads the correct content of object
    
          if not component.invoke(addr, "isDirectory", "/lib/core/" .. object) then --if object is not a directory (a file) 
            local lib, err = loadfile("/lib/core/" .. object) --calls loadlib. this function reads the file and returns a function lib. when lib is called it returns the table corresponding to the library loaded
    
    		--at this point when i call error(type(object)) i get that object is a string
    
            local name = string.sub(object, 1, #object - 4) --here i get the error "attempt to get length of a number value"  sugesting that object has now became a number
    
    --[...]

     

    i have been thinkering for some time now, however i didnt manage to solve the error. Thanks

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.