Forums » Community Projects

Lua exposed functions

Dec 06, 2012 jeff2 link
I cannot load just about any JSON modules out there, including the one aikon posted with his tcp lib, because getmetadata() and setmetadata() as well as module() are nil. I am no lua expert, but afaik those are defined by lua 5.1, which is what vo uses according to the wiki.

Is there a reason those cannot be exposed? I'm working on a plugin that stores data remotely and spickle is not really sufficient for the data I need to move back and forth.

Has anyone worked with any lua json libs successfully from within vo?
Dec 07, 2012 draugath link
The VO Lua API is restricted in various ways for security, privacy, and other reasons I'm not privy to.

Use this: http://sandbox.0x0b.de/httplib.zip
Dec 07, 2012 jeff2 link
Thanks. That JSON module works perfectly. I appreciate the tip!

I do wonder why the API is *so* limited.
Dec 07, 2012 abortretryfail link
He said for security and privacy reasons.

I'm pretty thankful that the devs limited it in such a way that I (mostly) don't have to worry about malicious plugin code damaging my computer. The worst it can do is mess up the game for me.
Dec 07, 2012 jeff2 link
Yeah, I got that. But setmetatable and getmetatable only manipulate method lookup for objects in lua afaik. And module just declares a module - it's used in the json package that Aikon posted. Those are built-ins that do not reach out to the OS in any way.
Dec 07, 2012 slime73 link
They can potentially be used to break the game's Lua sandbox. At the very least, it would add more hassle and frustration for the developers when deciding what should be added to the sandbox.