Parsing Lua files
So I have .lua files, I simply want to be able to retrieve ande dit the values in the Lua variables toe dit them from a C# Gui application
if that makes sense
For example the Lua file has a variable LUA_STRING_VARIBLE = "bear"
I want to be able to load and edit the file in my app to be able to change it to LUA_STRING_VARIBLE = "whale" for example.
I can't figure out how to parse/read and retrieve values from variables in .lua files, I'm trying to use Nlua but I can't understand it at all
40 Replies
Your post doesn't contain a question, which means it's less likely to get an answer
What exactly have you tried, and what made you think it didn't work?
I've tried using a few LUA libs and I simply can't find any functions or features to read data from the file, and they're overly complicated
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
* you don't have wait for the party to reply especially Async (tchat/forum/mail/ticket/messaging app)
* you wait if you're speaking verbally, audio call / conf call / sitting 1 meter away and you're sure you're not interrupting
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
So I have .lua files, I simply want to be able to retrieve and edit the values in the Lua variables to edit them from a C# Gui application
if that makes sense
For example the Lua file has a variable
LUA_STRING_VARIABLE = "bear"
I want to be able to load and edit the file in my app to be able to change it to LUA_STRING_VARIABLE = "whale"
by loading the value to a textbox in my GUI app
I've tried using some of the Nlua functions but they don't return anything and are completely incomprehensible
using (Lua lua = new Lua())
{
bool filexists = File.Exists(extracted_filepath); // check if file exists
LuaFunction loadedfile = lua.LoadFile(extracted_filepath);
var outputstr = loadedfile.ToString();
var objects = lua.DoFile(extracted_filepath);
var callresult = loadedfile.Call(objects);
}
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
really ? It's basically like parsing json but lua format, is what I'm doing really that rare
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I'll eventually have to do the same with XML and CPP files, I wanna edit some source files "programaticaly"
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yeah parsing was only the first step to get it loaded to my GUI
do you know any solution for this ?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
okay
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
My GUI is pulling a data from a lot of different components, I need all in one
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
can I import this to my WPF app ?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
This is gonna be a lot ahrder than expected 😄
I simply wanted a library that would do something like
lueafile = lua.readfile("filepath");
string luavariable = lueafile.getdatafromvariable(variablename = "LUA_STRING_VARIABLE");
is this really alien
and then same for writting, input variable name and value
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
a game interface file
trying to modify game data from my GUI
it's a modding tool
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
it's single player on my pc
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
He's referring to WoW addons which are written in LUA and are perfectly fine
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
we share similar servers
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
because the addons are on local
im assuming?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
It's perfectly fine to be skeptical of people haha
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
well more like it's local changes that don't affect others
these addons are designed to be edited and are Blizzards official modding API
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I was simply looking for some very simple data edition like quickly changing a color or string name, I'll probably just try some plain text/regex implementation or give up, thanks for the help
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
someone suggested hardcoding the row names that contain the variables, prob the easiest way
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View