Posted 10 December 2014 - 07:00 PM
Hey everybody !
I was bored and decided to make some kind of program that runs a program and logs most of the things it does.
Well, turned out that it is not that easy…
Currently I am really not that far in my code so… This is it (probably terrible wrong ^^) Or atleast the relevant parts:
Right now, I am always getting an error when trying to write something to my logger file. It gives me an "attempt to concatenate string an function/table whatever".
Im pretty sure its because I am trying to write k or v or so in the file without converting it into the right format.
However I have absolutely no idea how to fix this ?
It would be pretty awesome if someone could help me :)/>
mfG Kouksi44
I was bored and decided to make some kind of program that runs a program and logs most of the things it does.
Well, turned out that it is not that easy…
Currently I am really not that far in my code so… This is it (probably terrible wrong ^^) Or atleast the relevant parts:
setmetatable(mt,{__index=function(t,k) logger.writeLine("program tried to access undefined value at key"..k.." in table "..t) logger.flush() return _G.t[k] end, __newindex=function(t,k,v) logger.writeLine("Program tried to create new value at "..k.." with value"..v.." in table "..t) logger.flush() end})
setfenv(content, mt)
content()
Right now, I am always getting an error when trying to write something to my logger file. It gives me an "attempt to concatenate string an function/table whatever".
Im pretty sure its because I am trying to write k or v or so in the file without converting it into the right format.
However I have absolutely no idea how to fix this ?
It would be pretty awesome if someone could help me :)/>
mfG Kouksi44