Git Product home page Git Product logo

Comments (10)

trsh avatar trsh commented on July 19, 2024

Additionally how do I set a glob val that is == nil / empty?

from rlua.

trsh avatar trsh commented on July 19, 2024

Never mind

from rlua.

naturallymitchell avatar naturallymitchell commented on July 19, 2024

@trsh you're gonna post a good question, figure it out, then leave us hanging?

what'd you find??

from rlua.

trsh avatar trsh commented on July 19, 2024

@mitchtbaum for the 1st question:

      let eval_res = lua.eval::<String>(code, None);
      match eval_res {
        Ok(val) => {
          
        }
        Err(e) => {
          
        }
      }

e will contain Lua errors.

For the nil question, my answer is just not to set that Global. And it will be nil, as all undefined variables in Lua.

from rlua.

naturallymitchell avatar naturallymitchell commented on July 19, 2024

@trsh these say to use xpcall. is that another approach?

what about try-catch error handling exception pattern? are these ever used together?

I posted an issue in the framework I'm working on. if you're also interested in actix-web and lua, then I'd love your input.

from rlua.

trsh avatar trsh commented on July 19, 2024

@mitchtbaum sorry, I can tell nothing more. My approach is working for my project, so i dont investigate further. And I use actix-web.

from rlua.

trsh avatar trsh commented on July 19, 2024

@mitchtbaum one thing that I wan't, and could not figure out, is how to get print (printed stuff in lua), to Rust back. If you know that, let me know. For now I throw exceptions to debug stuff.

from rlua.

naturallymitchell avatar naturallymitchell commented on July 19, 2024

I'm not sure I understand. what is the goal? to pipe stdout back to Rust? I thought you already showed you can get the error object. Does throwing an exception give different debug output?

from rlua.

naturallymitchell avatar naturallymitchell commented on July 19, 2024

I think if it happens anywhere in my code base, it'd be here

https://github.com/foundpatterns/torchbear/blob/aadee3f603c9a1d1dd2ded5d3f579300a704561a/src/lua_bindings/log.rs#L6-L15

that receives strings from Lua to use in Rust code, I think evidenced by its use of push and push_str()

we're not using it anymore, since we switched to using log.lua

from rlua.

trsh avatar trsh commented on July 19, 2024

Throwing an exception returns Error to Rust, that includes the error lines. Ok result return whatever you return with "return xx". So Print invisible.

from rlua.

Related Issues (20)

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.