Ulysses

General => Developers Corner => Topic started by: bender180 on May 21, 2013, 09:00:18 AM

Title: file.Read
Post by: bender180 on May 21, 2013, 09:00:18 AM
Sorry that this isnt ulx/ulib related not sure what the rule on that is but ive been trying to convert a gmod 12 addon to work with 13 ive been using this guide https://docs.google.com/document/d/1khSuIYrAMkqXu7wlH5YRJNwz6hOH6Xqi5lqBhE3x6gA and i cant figure out why this
Code: [Select]
local HoverboardTypes = util.KeyValuesToTable(file.Read("hoverboard/hoverboards.txt", "DATA"))
is returning this
Code: [Select]
[ERROR] addons/hoverboard/lua/weapons/gmod_tool/stools/hoverboard.lua:9: bad argument #1 to 'KeyValuesToTable' (string expected, got no value)
Im just using file.Read for the first time so sorry if its something stupid.
Title: Re: file.Read
Post by: MrPresident on May 21, 2013, 09:34:46 AM
does garrysmod/data/hoverboard/hoverboards.txt exist?

If it does, does it have anything in it?
Title: Re: file.Read
Post by: Megiddo on May 21, 2013, 09:39:54 AM
Does the file exist in data/hoverboard/hoverboards.txt? Does it have content?

Or so I was going to say, before Mr. P beat me to the punch. Guess that's the trouble of leaving tabs open for a while. I'm glad that Mr. P and I agree completely on how to debug the issue, though. :P
Title: Re: file.Read
Post by: bender180 on May 21, 2013, 09:46:01 AM
the file is in the addon folder so \garrysmod\garrysmod\addons\hoverboard\data\hoverboard\hoverboards.txt i havent check the contents of that file yet so it might be the file isnt compatible with 13.
Title: Re: file.Read
Post by: MrPresident on May 21, 2013, 09:48:34 AM
Move the file out of the addons folder into the raw data folder.

I think garry still hasn't fixed his issues with file.Read not reading from the addons folder completely yet.
Title: Re: file.Read
Post by: bender180 on May 21, 2013, 09:52:37 AM
alright ill give that a try but since addons are virtual would the game not consider it in the data folder already?
Title: Re: file.Read
Post by: MrPresident on May 21, 2013, 10:03:11 AM
It should.. but what happens is the engine prioritizes or something like that, so it will not see it there. I think ULX was having those issues before they wrote their own I/O library.
Title: Re: file.Read
Post by: Megiddo on May 21, 2013, 10:10:56 AM
You are indeed running into gmod's file reading bug there, bender. We have it documented here (https://github.com/Nayruden/Ulysses/issues/185).
Title: Re: file.Read
Post by: bender180 on May 21, 2013, 11:55:05 AM
Ah i see thanks.