36 posts
Posted 24 August 2013 - 05:34 AM
Hey Guys, I just wanted a simple Configuration File with variables in it,
but I don't want to read it and assign a variable to each line/value, so I tried using os.loadAPI("myFile") on my File, but It only includes 1 of 3 variables defined in my file…
The File, which is beeing loaded via. os.loadAPI("settings")
language= 1 ,
IHTMLvNumber = "0.1",
languages={"German","English n/a"}
textutils.serialize(settings) returns
{["HTMLvNumber = "0.1""]}
Any1 has an Idea why this happens, or how to fix this ?
Greetings ;)/>
mark332
2217 posts
Location
3232235883
Posted 24 August 2013 - 06:15 AM
it would actually return {["HTMLvNumber"] = "0.1"]}
but anyway
i actually tried this and i got a syntax error from the ,s
but all the variables are in there when i remove them
36 posts
Posted 24 August 2013 - 08:12 AM
?
Excuse me, if I don't understand everything…. I'm german at first. :D/>
871 posts
Posted 24 August 2013 - 11:46 AM
Like this instead
language= 1
IHTMLvNumber = "0.1"
languages={"German","English n/a"}
The ","s at the ends were invalid syntax.
36 posts
Posted 24 August 2013 - 01:26 PM
Well, if I do this:
language= 1
IHTMLvNumber = "0.1"
languages={"German","English n/a"}
and load it with os.loadAPI("settings")
textutils.serialize(settings) returns
{["HTMLvNumber = "0.1",}
I'm near at thinking "CC ist trolling me, right?" :huh:/>
871 posts
Posted 24 August 2013 - 01:32 PM
works fine. If it's not working for you, then you're doing something else, not explained in this thread, that is breaking it.
Full, actual code, please.
36 posts
Posted 24 August 2013 - 01:42 PM
There's no full, actual code, I just type "lua" and then "os.loadAPI("BeTECH/USERDATA/bt-settings/settings")" (<– Full Path to the File) and then, just this happenes :(/>
8543 posts
Posted 24 August 2013 - 02:13 PM
As you can clearly see, what you've said is happening doesn't make sense. The same thing you claim to be doing is working for Gopher the way you intend this to work. You must be doing something wrong on your end. Please verify that you've copied the code from the settings file correctly and that you aren't reloading another version of the settings file that does not contain all of the information or some similar problem.
36 posts
Posted 24 August 2013 - 02:20 PM
well, I'll poste the File…
here:
http://hastebin.com/gogudukudi.iniI also could make a recording, if you don't belive that… D:
36 posts
Posted 24 August 2013 - 02:37 PM
The thing is, If I type: "edit
BeTECH/USERDATA/bt-settings/settings" im the main shell it shows me
language= 1
IHTMLvNumber = "0.1"
languages={"German","English n/a"}
:/
36 posts
Posted 24 August 2013 - 03:00 PM
Well, now it works IF I load it up manually via. lua,
but: If I use this code, the Problem is still there:
{Code has been removed!}
Tell me, if you need the values of the functions/vars, then, I'll Post them at HasteBin
8543 posts
Posted 24 August 2013 - 03:56 PM
We need all of the code in order to help.
871 posts
Posted 24 August 2013 - 03:56 PM
Full, actual code, please.
That is clearly not all of the code. It defines a function, startup, which is not being called, and it calls a function, MainMenu, which is not defined.
36 posts
Posted 24 August 2013 - 04:01 PM
The Function MainMenu doesn't Matter, 'cause I've terminated the Programm, before the MainMenu could be called… but
here is my "gen" API:
http://hastebin.com/vajeruwada.luaAnd, like the name of the Function sais, "startup()" is the first executed thing of my program ;)/>
8543 posts
Posted 24 August 2013 - 04:06 PM
You do realize we're trying to figure out why you think your settings aren't being loaded correctly, right? I still haven't seen anything that even references the settings at all. How do you expect us to help if you won't give us all of the code that's involved here?
36 posts
Posted 24 August 2013 - 04:58 PM
Well, okay, I'll Post a Link of a .zip, which includes the three relevant files…
36 posts
Posted 24 August 2013 - 05:01 PM
871 posts
Posted 24 August 2013 - 06:07 PM
The only thing I see referencing settings after it is loaded is the cat_config function in the OS file, which tries to access settings.tVars.language and settings.tVars.language, which shouldn't exist, as there is no tVars table declared in the settings file.
36 posts
Posted 25 August 2013 - 09:24 AM
The only thing I see referencing settings after it is loaded is the cat_config function in the OS file, which tries to access settings.tVars.language and settings.tVars.language, which shouldn't exist, as there is no tVars table declared in the settings file.
oh, thanks, but my problem is not in the program "OS" itself, it's, if I've runned the program, terminated it and trying to access settings.<not
IHTMLvNumber>.
textutils.serialize always returns
{["IHTMLvNumber = "0.1",} on settings….It just looks like, "hey, I'm Lua, let's ignore 2 of 3 lines…" -.-
36 posts
Posted 25 August 2013 - 02:40 PM
Nevermind, found my Mistake in Line 1:
settings = { IHTMLvNumber = "0.1"}
xDD