This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
ChunLing's profile picture

[Question] rom API loading order

Started by ChunLing, 20 November 2012 - 03:12 PM
ChunLing #1
Posted 20 November 2012 - 04:12 PM
Hey, I'm trying to put some turtle functions in a rom based API. The problem is that this tends to load before the turtle API and the result is that all the turtle functions get called in their native form (like, the java versions, you know?). This is kinda cool and all, but it breaks all the stuff that needs returns from those functions, the breakages range from subtle to fatal but I'd like to avoid all of them. So, do I just have to recreate the turtle api lua in my api or is there a way to have my api load after the turtle api has loaded?
Lyqyd #2
Posted 20 November 2012 - 04:54 PM
You may be able to do something like this at the top of your API:


if not turtle then
    os.loadAPI("/rom/apis/turtle/turtle")
end
ChunLing #3
Posted 20 November 2012 - 05:13 PM
Ah…that's an idea. But I think that I'd have to use "if not turtle.native", right? Cause the turtle stuff is defined in java. I'll try it.
ChunLing #4
Posted 20 November 2012 - 05:33 PM
Worked like a charm.