ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
|
| 24 Jul 2014 05:58 PM |
I use package.path to access my two libraries for my script "OBJParser". The werid thing is, it doesn't work when I use require in main.lua but when I add os.execute("pause") at the end of OBJParser, it passes through without a problem.
Can anyone tell me why this is happening and perhaps a way to fix it? Any help is greatly appreciated.
main.lua: require "assets.render.OBJParser" --Irrevelant code
OBJParser.lua: package.path = package.path .. ";..\\lib\\?.lua" require "Vector2" require "Vector3" --Irrevelant code
ERROR: module 'Vector2' not found
Directory tree(only showing relevant paths):
Love2D Framework(master) ~assets ~~lib ~~~Vector2.lua ~~~Vector3.lua
~~render ~~~OBJParser.lua
main.lua |
|
|
| Report Abuse |
|
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
|
| 24 Jul 2014 05:59 PM |
EDIT:
I messed up on the Directory tree.
Love2D Framework(master) ~assets ~~lib ~~~Vector2.lua ~~~Vector3.lua
~~render ~~~OBJParser.lua
~main.lua |
|
|
| Report Abuse |
|
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
|
| 24 Jul 2014 06:53 PM |
| I noticed that I do not get much help here. |
|
|
| Report Abuse |
|
|
Undoomed
|
  |
| Joined: 19 Oct 2010 |
| Total Posts: 1662 |
|
|
| 24 Jul 2014 06:56 PM |
| Most people don't like to help others when they say "it doesn't work" without explaining what is the error and what it was meant to do.. |
|
|
| Report Abuse |
|
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
|
| 24 Jul 2014 07:02 PM |
@Undoomed
I explicitly say that I am using package.path and require() to access my files in a different directory and I give you the error. Everything that you said that I didn't do, I did. |
|
|
| Report Abuse |
|
|
Undoomed
|
  |
| Joined: 19 Oct 2010 |
| Total Posts: 1662 |
|
|
| 24 Jul 2014 07:04 PM |
By error I mean the error in output. You said it "doesn't work"..
You don't see
Output: Doesn't work. Go to scripting helpers. |
|
|
| Report Abuse |
|
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
|
| 24 Jul 2014 07:15 PM |
@Undoomed
"By error I mean the error in output. You said it "doesn't work"..
You don't see
Output: Doesn't work. Go to scripting helpers."
I still don't understand why you didn't notice that I said "it doesn't work when I use require". You focused on the words "it doesn't work" and did not look at anything else. |
|
|
| Report Abuse |
|
|
Undoomed
|
  |
| Joined: 19 Oct 2010 |
| Total Posts: 1662 |
|
|
| 24 Jul 2014 07:18 PM |
| Still not an output. You shouldn't expect help when you don't provide information. |
|
|
| Report Abuse |
|
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
|
| 24 Jul 2014 07:25 PM |
@Undoomed
I find it funny that when I give the important parts of my scripts, the error message, and the directory tree, you say that I don't provide information. |
|
|
| Report Abuse |
|
|
Undoomed
|
  |
| Joined: 19 Oct 2010 |
| Total Posts: 1662 |
|
|
| 24 Jul 2014 07:26 PM |
Okay I don't think I will help. I mentioned a few times I am looking for the OUTPUT, not just random bits of information.
Good luck. |
|
|
| Report Abuse |
|
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
|
| 24 Jul 2014 07:30 PM |
| Do I need to rename ERROR to OUTPUT for you? |
|
|
| Report Abuse |
|
|
Undoomed
|
  |
| Joined: 19 Oct 2010 |
| Total Posts: 1662 |
|
|
| 24 Jul 2014 07:36 PM |
| I'm sure to some unevolved minds the words Output and Error are synonyms, but I'm afraid scripting cannot be done by unevolved minds. |
|
|
| Report Abuse |
|
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
|
| 24 Jul 2014 07:38 PM |
| I would think that people would have enough common sense to understand that the error comes from the output. |
|
|
| Report Abuse |
|
|
Luc599345
|
  |
| Joined: 25 Jul 2008 |
| Total Posts: 1169 |
|
|
| 24 Jul 2014 07:40 PM |
Can't tell if Undoomed is a troll
[ontopic]
I don't quick get your tree, could you do something that ressembles :
mainfolder - folder1 -- file1 - folder2 -- file2
Mainfolder being the main folder (duh), folder1 and folder2 being folders in mainfolder and file1 and file2 being files in folder1 and folder2, respectively |
|
|
| Report Abuse |
|
|
Luc599345
|
  |
| Joined: 25 Jul 2008 |
| Total Posts: 1169 |
|
|
| 24 Jul 2014 07:42 PM |
| Nvm, ignore that, that's exactly what you did |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 24 Jul 2014 07:42 PM |
-assets --lib ---Vector2.lua ---Vector3.lua --render ---OBJParser.lua |
|
|
| Report Abuse |
|
|
Luc599345
|
  |
| Joined: 25 Jul 2008 |
| Total Posts: 1169 |
|
|
| 24 Jul 2014 07:45 PM |
I'm not sure, but : package.path = package.path .. ";..\\..\lib\\?.lua"
I've never quite worked with love2d, but also try making sure you're running from the whole folder, not just main.lua/objparser.lua |
|
|
| Report Abuse |
|
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
|
| 24 Jul 2014 07:47 PM |
@luc599345
Sure thing.
Love2D Framework(Main folder) - main.lua(inside Main folder)
- assets(folder, inside Main folder) -- lib(folder, inside assets) --- Vector2.lua(inside lib) --- Vector3.lua(inside lib)
-- render(folder, inside assets) --- OBJParser.lua(inside render) |
|
|
| Report Abuse |
|
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
|
| 24 Jul 2014 07:57 PM |
Thank you everyone(except Undoomed), for helping me. I managed to figure out a solution that strangely only works for main.lua.
package.path = package.path .. ";.\\assets\\lib\\?.lua" |
|
|
| Report Abuse |
|
|
Luc599345
|
  |
| Joined: 25 Jul 2008 |
| Total Posts: 1169 |
|
|
| 24 Jul 2014 07:59 PM |
| Well, that'd obviously work since "." is basically "same folder" as main.lua, but I'm still intrigued by the "OBJParser.lua" one. Did you find a fix to that? |
|
|
| Report Abuse |
|
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
|
| 24 Jul 2014 08:11 PM |
Yes, actually that is where I put: package.path = package.path .. ";.\\assets\\lib\\?.lua"
The main.lua was fine to begin with, I just included that file to show where OBJParser.lua was originally called. |
|
|
| Report Abuse |
|
|
Luc599345
|
  |
| Joined: 25 Jul 2008 |
| Total Posts: 1169 |
|
|
| 24 Jul 2014 08:21 PM |
| Oh, that would make sense, I think. Does require(objparser.lua) run inside main.lua or creates a seperate "thread" that runs out of "objparser.lua"? If you run objparser.lua alone, would it work? |
|
|
| Report Abuse |
|
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
|
| 24 Jul 2014 08:30 PM |
require("assets.render.mesh.OBJParser") runs inside main.lua.
I tried running OBJParser.lua alone, it seems to be working just fine. |
|
|
| Report Abuse |
|
|