GithubHelp home page GithubHelp logo

Comments (2)

kikito avatar kikito commented on August 14, 2024

Hi dannifritz/technocat!

This is completely intentional. Being able to do tween.update(dt) only in one place, and having all the tweens updated, independently of the file they were created in, is good IMHO.

This relates with how Lua's require function works. The first time you invoke it, it reads the file you told it to read, and returns whatever it's supposed to return (a table, a function, nil, etc). Any subsequent call to require, however, will not parse the file; it has the result "cached", so it is returned directly instead of parsing the file again. So, in a way, require is designed to created "sort of self-contained singletons". So I try to use my libs in the same way.

Besides, I think in LÖVE in particular is very convenient; you just call tween.update(dt) inside love.update and everything works.

If you wanted to have several separated tween update cycles you have to use Lua's loadfile or LÖVE's love.filesystem.load . Both will create new closures every time their "returning chunks" is executed. In theory this will create several independent lists of tweens. But, I must warn you: I haven't designed the library with that in mind, and have not tested that behaviour. I'm pretty sure that will work. I'm not sure I'd want to use it that way though.

Best regards!

from tween.lua.

dannyfritz avatar dannyfritz commented on August 14, 2024

Thanks for the reply. Glad it was intentional.
And thanks for the loadfile tip!

from tween.lua.

Related Issues (16)

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.