IO and Gadgets?

IO and Gadgets?

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

IO and Gadgets?

Post by Argh »

How can I use io to write to a file using a Gadget? Spring throws an error, says that it can't find the global 'io'... and I have something I need to write to a file via a Gadget.

i.e., file = io.open('myfilenamehere.txt', 'w+') doesn't work, in a Gadget.

Works in Widgets just fine, I've used it for a lot of stuff, it's very puzzling.

Can't do what I need to do in a Widget, though, it absolutely has to be a Gadget (unsynced doesn't matter).
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: IO and Gadgets?

Post by lurker »

Looks like it uses the same BLOCK-EVERYTHING function for either half of gadgets.

But what in the world actually needs i/o? The end-user can change files at will; what's wrong with using a widget? People with luaui off?
User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

Re: IO and Gadgets?

Post by TheFatController »

I'm guessing its for security to make it a bit harder for someone to secretly write a bat file into "C:\Documents and Settings\All Users\Start Menu\Programs\Startup"

(tho imo widgets shouldn't beable to do this either!)
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: IO and Gadgets?

Post by lurker »

Can widgets?
User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

Re: IO and Gadgets?

Post by TheFatController »

Oh damn it was last time I checked, it looks like it was fixed which is nice.. :)
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: IO and Gadgets?

Post by Argh »

Meh, that's lame, this needs to get changed.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: IO and Gadgets?

Post by Pxtl »

??? How would you even synch the data in the gadget?

Probably what you'll have to do is write it as a widget, synch the data to all players (so every player has every other player's file data) and then run some sort of arbitration system to decide whose version gets priority.
TheFatController wrote:(tho imo widgets shouldn't beable to do this either!)
Why not? Security reasons? Personally, I like the idea that widgets can save and load their own widget-specific data.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: IO and Gadgets?

Post by lurker »

Pxtl wrote:Probably what you'll have to do is write it as a widget, synch the data to all players (so every player has every other player's file data) and then run some sort of arbitration system to decide whose version gets priority.
You'd have to do that with gadgets too, communicating from unsynced to synced.
Pxtl wrote:
TheFatController wrote:(tho imo widgets shouldn't beable to do this either!)
Why not? Security reasons? Personally, I like the idea that widgets can save and load their own widget-specific data.
Shouldn't be able to escape the spring directory.
Post Reply

Return to “Lua Scripts”