Main Menu

API Problem

Started by Fallout, Oct 11, 2023, 03:48 AM

Previous topic - Next topic


Despite having programming experience I am having some very painful problems with CC

I am using an Advanced Mining Turtle with an Ender Modem. I have setup the GPS constellation with standard computers and Ender Modems and edited the startup.lua as appropriate for each device. My mining bot can get it's gps location using gps locate. So I think I am all set in that department.

Where I am striking problems.
I have my program and an API saved on disk which I have copied to the root level of the turtle using copy /disk/locale.lua / and I can see locale.lua on the turtle but when I try and get another program to reference it using os.loadAPI("locale") and then call it from my test.lua I get bios.lua:567: Failed to load API locale due to File not found.

What am I doing wrong?


I am writing my first lua scripts but I am striking a problem..

I have the line os.loadAPI("locale") in my test.lua main file and when it is run it results in

"bios.lua:567: Failed to load API locale due to File not found."

test.lua and locale.lua are both in the root directory of the turtle.

I have also tried:
local myModule = require("locale")

that didn't work either.


Are you sure that it copied to the turtle correctly?

Have you ran ls on the turtle to verify that the file copied with the name that you expect without having the disk connected?

Are you running any OS programs other than the one built into the mod?


If it says "API not found", then you have a issue loading it from the file directly.

If it is in the root folder, make sure you directly link the file like the example code below.

local function ensureAPILoad(pathToFile)
  if fs.exists(pathToFile) then
  elseif fs.exists("/"..pathToFile) then
    error("Couldn't find file, as it doesn't exist. Check your filesystem for more info.", 2)

GOTTA GO FAST!!!! - Sunrise Studios now calling testers! Check the post!
Gitlab - Join my official discord! - SS Discord