ULX

Author Topic: file.Read  (Read 3958 times)

0 Members and 1 Guest are viewing this topic.

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
file.Read
« 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.
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: file.Read
« Reply #1 on: May 21, 2013, 09:34:46 AM »
does garrysmod/data/hoverboard/hoverboards.txt exist?

If it does, does it have anything in it?

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: file.Read
« Reply #2 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
Experiencing God's grace one day at a time.

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
Re: file.Read
« Reply #3 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.
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: file.Read
« Reply #4 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.

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
Re: file.Read
« Reply #5 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?
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: file.Read
« Reply #6 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.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: file.Read
« Reply #7 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.
Experiencing God's grace one day at a time.

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
Re: file.Read
« Reply #8 on: May 21, 2013, 11:55:05 AM »
Ah i see thanks.
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.