Archaegeo / DualUniverseLuaIssues

DualUniverse LUA Issue Tracking
GNU General Public License v3.0
5 stars 0 forks source link

Rendering input/output should be a Lua object #47

Closed samdeane closed 2 years ago

samdeane commented 2 years ago

Honestly, what's with the whole string-thing?

It just makes us do work every time we want to send something non-trivial, which you could easily do for us.

You are probably turning it into JSON behind the scenes, so if you want to impose a size limit (eg 1000 characters or whatever), just apply it to the JSON-encoded form of the object.

Would help with #46 too.

NQ-Ligo commented 2 years ago

No it's not parse in JSON in back, that's an arbitrary limit of 1024 character on a string. :)

samdeane commented 2 years ago

No it's not parse in JSON in back, that's an arbitrary limit of 1024 character on a string. :)

Ok, well my speculation about the JSON-backend was a distraction from my main point, so sorry about that.

My main point was that setScreenInput() and setOutput() really ought to accept any lua type (eg tables and numbers as well as strings), and pass them through correctly to the receiving script.

I can see that you will still want to impose a size limit somehow, but it’s not impossible to do that with arbitrary lua types (worst case scenario, just apply some form of text conversion on them and check the size of that).

Yes, applying the size limit for non-strings would be slower, but so is making us convert non-string data to a string, then convert it back at the other end. At least if you did it for us, your code could potentially be C++.