Giter Site home page Giter Site logo

Improvement to API load tests about ccapis HOT 5 OPEN

fnuecke avatar fnuecke commented on June 19, 2024
Improvement to API load tests

from ccapis.

Comments (5)

fnuecke avatar fnuecke commented on June 19, 2024

I haven't played around with Lua in resource packs, so I have no idea, but what you say sounds logical to me. A simpler adjustment might be

assert(os.loadAPI("apis/startup") or os.loadAPI("/rom/apis/startup"))

My reasoning for trying the old way first is to still allow overwriting whatever is provided via resource packs.
Could you test this to see if it works?

from ccapis.

michthom avatar michthom commented on June 19, 2024

Ah - good points, and yes I'll test this and let you know.

Sadly there doesn't seem to be a way to suppress the 'file not found' message to the console from loadAPI.
I was hoping for a "command > /dev/null" equivalent but haven't found one yet.
Using 'protected mode' didn't help either e.g.

local state, value = pcall ( os.loadAPI, "apis/startup")
if ( state ) then ... else ... end

Happy New Year by the way!

On 1 Jan 2014, at 03:56, Florian Nücke [email protected] wrote:

I haven't played around with Lua in resource packs, so I have no idea, but what you say sounds logical to me. A simpler adjustment might be

assert(os.loadAPI("apis/startup") or os.loadAPI("/rom/apis/startup"))
My reasoning for trying the old way first is to still allow overwriting whatever is provided via resource packs.
Could you test this to see if it works?


Reply to this email directly or view it on GitHub.

from ccapis.

fnuecke avatar fnuecke commented on June 19, 2024

Ah, right, that. I remember I was also annoyed by that just printing to the screen when it (I feel) shouldn't. An fs.exists check may be necessary or something along those lines...

And a happy new year to you, too!

from ccapis.

michthom avatar michthom commented on June 19, 2024

Hi Florian

I think I’ve fixed the issue, with minimal code changes, once I’ve tested properly I’ll send you a diff to look at?
Or should I fork / commit / send you a pull request in github?

The bios was loading the lama API on a freshly-created turtle, and the check in the main code path through the API for os.computerLabel() was failing the assert(). That led to the blank screen in the CC console as the bios doesn’t seem to like assert failures in os.loadAPI().

I moved all the main code path asserts into the init() code path, after the check for isInitialized, so they only get run once.

I’ve left the original apiPath definition alone, but added a manual search for valid locations if bapil is not available.

Sticking the lama API in /rom/apis/turtle/lama then hides it from computers, and I think it’s good to go.

Thanks for your help and gentle suggestions (which caused me to face palm myself for stupidity!)

Cheers
Mike

On 1 Jan 2014, at 14:36, Florian Nücke [email protected] wrote:

Ah, right, that. I remember I was also annoyed by that just printing to the screen when it (I feel) shouldn't. An fs.exists check may be necessary or something along those lines...


Reply to this email directly or view it on GitHub.

from ccapis.

fnuecke avatar fnuecke commented on June 19, 2024

Sounds good! A pull request would be the easiest for me, but you can make it a patch, if you prefer.

from ccapis.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.