-
-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tic80 doesn't find my required lua files #2426
Comments
|
I may misunderstand, but I think it does, see #2352 |
I never used it, not sure I can help but I try anyway: Did you look at https://github.com/nesbox/TIC-80/wiki/Using-require-to-load-external-code-into-your-cart ? From what I understand the libraries should be in Also, I think current directory in TIC-80 is always However, note that the use of |
not true, i tried with some of dirs shown in error message and they worked... the problem reported here is it seems like tic80 embedded lua only sees the folder where
yes i tried what that wiki page says and doesn't work (maybe worked in a previous tic80 version)... and for regular lua files other than modules or libraries (e.g. grouplng similar functions, etc.) should work in tic80 command console "cwd" (current working directory, shown in prompt synbol), or the dir where current cart were loaded
i agree with @moonlit in that this behavior is confusional, prone to provoke errors and should be fixed
|
i am using this dirty workaround (it bothers, should load files in same directory without the need of doing these tricks):
|
As i said originally:
There is a huge difference between "it works" and "it is supported". I'll repeat: This is not supported - it should never work, the existing behavior is a bug. Some people wish it was [supported] (there is a ticket for this), but it's currently not. And there is also a ticket to "break" it fully as it's a security risk - and not supported. If require simply never worked period, all the confusion would be gone. |
@joshgoebel ok |
the behaviour indeed can be a bit erratic: for some computers, i've had to add the following line to my
It adds your working directory to Lua's package.path so Lua can find your files. |
@borbware : as i thought
but didn't worked :( ... is there any way to do this permanently? (i think it should come from stock) @TimotheeGreg : i think the instructions in the page you posted are wrong ( https://github.com/nesbox/TIC-80/wiki/Using-require-to-load-external-code-into-your-cart#where-to-locate-our-module-files ) there it says "Open up tic80 and at the console type folder" and create a |
(edited after replies to add images) i found a better workaround that works: as a response to my previous response @TimotheeGreg , i put together these 2 facts:
when i edit tic80.exe shortcut "start folder" as shown above, and add ... you can trace full expanded
or just use obviously this should be made only in development stage, once the project has done we must put it all together inside cart |
TIC-80 should really support some form of multi-file support. It need not be the native
I don't think this violates the retro spirit of TIC-80 more than the editor outline and bookmarks views do already and I'm not sure what use the console (e.g. mkdir) is without this sort of feature. |
You can already use multiple files: https://github.com/nesbox/TIC-80/wiki/tools#bundling I hear you though, it would be nice if TIC-80 supported that directly, but:
That would IMO greatly bloat TIC-80, for a problem that is already mostly solved by one of the tools listed in the wiki. Granted, they only work with the PRO version (to my knowledge), but I think it's fine. The fact that |
EDIT: i found a workaround in #2426 (comment) , please dont nerf it
hi, i am in the programming developing/learning stage
to keep some order while in developing/testing i pretend to separate the program in various lua files, and call them with
require('my-lib')
in my cart code... previously i created a subfolder inside tic80 carts folder, to keep order i pretend later to create a separate folder for each project, with cart and all needed files insidecurrently my folder structure looks like
in tic80 console i must type these commands
ahd the code looks like this (for later production, i can simply concat all lua files, import it to cart and delete these
require
lines)but when i try to run the cart, it crashes and these messages appear in console
... i can clearly see the line
no file '.\oop.lua'
, but i swear this file exists as.\
stands for "current directory", and current directory inside tic80 is<cart folder>\001-oop
as i recently cd'ed and console prompt showsi think it must be a bug, that a required file exists in current directory, and current directory being expanded to tic80 console's current directory, by default, as console prompt shows .... but i see currently is not the case :( ... for user intuitiveness and ease it SHOULD be the default behavior
( see this issue also, is somewhat related: #2414 , maybe all these complications with files won't be necessary if editor would be multi-tabbed :) )
could you please fix this bug / correct this oddity / add this feature, in the future releases? ... thank you
The text was updated successfully, but these errors were encountered: