Team Spartan Cookies & Milk Forums
IO and compileString issues/broken - Printable Version

+- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk)
+-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html)
+--- Forum: Starfall (https://teamscm.co.uk/forum-7.html)
+--- Thread: IO and compileString issues/broken (/thread-1581.html)



IO and compileString issues/broken - Red The Blue Color - 07-02-2016

Everytime i try to :read("*a") any file it just errors with
addons/starfall/lua/starfall/libraries/libs_sh/io.lua:592: bad argument #1 to 'StringMatch' (string expected, got nil)

I even got pretty desperate and attempted to use Loc's mainframe since it uses files. Same problem

Reproduce error:

if not files.exists("rtbmf.txt") then
local RawFile = io.open("rtbmf.txt","w")
RawFile:write("test")
RawFile:close()
end
local RawFile = io.open("rtbmf.txt","r")
print(RawFile:read("*a"))

EDIT: compileString() appears to be broken aswell since it just returns nil no matter what happens
[SF - ERROR] SF:rtbctech/RTBMF.txt:532: attempt to call a nil value
compileString("print('test')")()
that error prob isn't helpful but im sure you get the point


RE: IO issues/broken - Yuri6037 - 07-02-2016

Well i'm not using the read method, I instead use the lines method to read files as Starfall is probably not the best platform for reading files as low level (byte per byte)... And also because I got similar issues with byte per byte reading on standard gmod...


RE: IO issues/broken - Red The Blue Color - 07-02-2016

(07-02-2016, 08:39 AM)Yuri6037 Wrote: Well i'm not using the read method, I instead use the lines method to read files as Starfall is probably not the best platform for reading files as low level (byte per byte)... And also because I got similar issues with byte per byte reading on standard gmod...

both involve reading so technically you are using a reading method trollface.jpeg Big Grin
I hope you realize that *a means full file not byte per byte


RE: IO and compileString issues/broken - TheOneAndOnlyTee - 07-02-2016

Seems you can add Submaterials to the list, Samo's ship isn't saving the ones he's set yet my ships load the submats fine.
EDIT: this problem began after me and Red reloaded #1's map to see the in editor starfall console, i noticed my compileString() returned nil but thought there was a mistake with my code.


RE: IO and compileString issues/broken - Person8880 - 07-02-2016

Both problems were caused from my changed files not being uploaded correctly. Will be fixed when the server(s) next restart/change map.


RE: IO and compileString issues/broken - Yuri6037 - 07-02-2016

(07-02-2016, 08:59 AM)Red The Blue Color Wrote:
(07-02-2016, 08:39 AM)Yuri6037 Wrote: Well i'm not using the read method, I instead use the lines method to read files as Starfall is probably not the best platform for reading files as low level (byte per byte)... And also because I got similar issues with byte per byte reading on standard gmod...

both involve reading so technically you are using a reading method trollface.jpeg Big Grin
I hope you realize that *a means full file not byte per byte

Oh ok well I did not know what *a means all file. I'm not programing much lua anyways. I'm better when you speak about file reading in C.