Lua and JSON
Moderator: Forum Moderators
-
- Posts: 5
- Joined: April 21st, 2012, 7:57 am
Lua and JSON
For the custom campaign I'm designing, I want to personalize it using JSON data from a server. This would be quite easy to do in Lua if I had access to the Lua socket library from within LuaML, but I realize there are security considerations. I was thinking of modifying Scripting/lua.cpp so as to make the socket library usable to my campaign WML files, but I'm concerned about the security implications of this, and wondering if what I propose could be possible without modifying Lua's source code, so I wouldn't have to create a separate Wesnoth distribution in order for users to play my campaign.
- Elvish_Hunter
- Posts: 1585
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: Lua and JSON
Given that we don't want that add-ons may be able to execute arbitrary code, your only option is a fork. By the way, what kind of data do you want to pass via JSON, exactly?Chris_Clark wrote:I'm concerned about the security implications of this, and wondering if what I propose could be possible without modifying Lua's source code, so I wouldn't have to create a separate Wesnoth distribution in order for users to play my campaign.
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
-
- Posts: 5
- Joined: April 21st, 2012, 7:57 am
Re: Lua and JSON
That makes sense, Elvish_Hunter. So I assume I should edit lua.cpp, add the sockets library and disable anything in the sockets library that I don't need? (as was done with the lua os library)
I don't mean to be mysterious, but I'd prefer to keep the exact nature of the JSON data under a Shroud until my campaign is ready for beta testing. If you'd like more details, I can PM you though.
I don't mean to be mysterious, but I'd prefer to keep the exact nature of the JSON data under a Shroud until my campaign is ready for beta testing. If you'd like more details, I can PM you though.
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: Lua and JSON
There is an :unsafe_lua command (or so) for the wesnoth command line (maybe only in debug mode). Perhaps that allows you somehow to do what you need.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign