I cannot require("folder/file"), Why? It's a simple file.lua inside main project directory in a folder with content:
return {[1] = "hello world"} |
error:
no field package.preload['folder/file']
no file './folder/file.lua'
<b>...</b> |
The file mentioned above is not included into Gideros Studio Project, because I plan to create them on Runntime and require() or delete again.
Is there a way of loading custom/normal modules and such lua files... ?
Comments
»Gideros Illustrator« - [svg|xml] scene designer using Adobe Illustrator®™ Within one line of code!
-Gideros Project
--main.lua
---folder
----file.lua <-here!
»Gideros Illustrator« - [svg|xml] scene designer using Adobe Illustrator®™ Within one line of code!
- If you're creating the file at runtime, it should be stored at documents or temporary directory.
- If it's added to the project (placed in resource directory), you cannot delete or modify it and can be loaded with require "folder.file".
If it is in the documents, how do i require it then?
The thing is: Regardless, It would be awesome having require() work for everythign, without including it into the project tree inside GiderosStudio. Similar to what cor.SDK does. Everything require() and your done.
»Gideros Illustrator« - [svg|xml] scene designer using Adobe Illustrator®™ Within one line of code!
You can't. It seems dofile or loadfile is the only way. (also if you're creating/modifying Lua files at runtime, I don't recommend using require because it caches the return value).
how about hassle-free ide for gideros? automatic project management, I mean. something that abandons this annoying manual file addition to the project tree...
»Gideros Illustrator« - [svg|xml] scene designer using Adobe Illustrator®™ Within one line of code!
»Gideros Illustrator« - [svg|xml] scene designer using Adobe Illustrator®™ Within one line of code!
»Gideros Illustrator« - [svg|xml] scene designer using Adobe Illustrator®™ Within one line of code!
As far as I know:
1. All Lua files that can be loaded with require should be packaged beforehand.
2. There is no dofile/loadfile.
»Gideros Illustrator« - [svg|xml] scene designer using Adobe Illustrator®™ Within one line of code!
As for the creation, download etc of dynamic lua files using doFile or loadFile, I'd also strongly advise against it. Apple's TOS explicitly forbids this kind of behaviour to stop any kind of post install, code download either malicious or not (in theory you could create your own in app appstore, or significantly change the behaviour of your app), so any app that appears to do this WILL get rejected by Apple.
If you want to share what it is your trying to achieve then I'm sure there are plenty of experienced people here who'll happily give you some pointers to steer you in the right direction.
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
Likes: techdojo
Likes: techdojo
It's worth noting that Eclipse (the IDE you didn't mention :-) ) does not require manual file management. In Eclipse you merely nominate a directory and all contents are automatically part of the project (the .project file does not contain a list of source files). Of course, you could end up with a lot of crud in your project. Eclipse deals with this by creating and managing its own filesystem in the workspace directory (if you create a new project in Eclipse). But if you import an existing project into Eclipse it just sucks everything up.
This behaviour is useful when developing for Android since I can reexport from Gideros and then just refresh the project in Eclipse. New resources or Lua files will automatically be added. I don't have to tell Eclipse "please add this file".
So this automatic inclusion approach is useful when one IDE acts as the backend for another (as Eclipse does for Gideros IDE). But it may not be best for the "primary" IDE.
https://github.com/gideros/gideros
https://www.youtube.com/c/JohnBlackburn1975
If you look at what happens when you run an app, the contents of the project listing get copied over (if newer) to the runner so there IS a kind of automatic project management going on.
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill