config.lua breaks game

Discussion about using Moai SDK - post questions, issues, and ideas here.

Moderators: naturally, seebs, ezraanderson

config.lua breaks game

Postby rpallen » Thu Dec 28, 2017 6:08 am

I'm at a bit of a loss. I'm going through the book "Developing Mobile Games with Moai SDK" by Francisco Tufró (Copyright © 2013 Packt Publishing). I realize this is a bit old, but everything was going fine, including using the code provided with the book, until a config.lua file was introduced. I can't get any programs to work with a config.lua file. Is there a problem naming a file config.lua?

I renamed this file to other things, including configuration.lua and the program seemed to run fine. But with a file named config.lua, it seems that main.lua doesn't run at all. I think this because there is no output printed for a print statement in main.lua, but output IS printed if there is no config.lua file.

Also, if I use the final code from the book as it is, when I run it, I get nothing. No errors are reported, but nothing happens. No window opens, NOTHING. But if I make two simple changes to the code, rename config.lua to configuration.lua and change the require statement in main.lua to require 'configuration' (instead of require 'config'), it works fine.

So is config a reserved word that can't be used as a file name or is there some other explanation?
Thanks.
rpallen
 
Posts: 3
Joined: Mon Oct 30, 2017 10:07 am

FOLLOWUP: config.lua breaks game

Postby rpallen » Thu Dec 28, 2017 6:41 am

Actually, after some more experimentation, I think something else is going on here. I'm using ZeroBrane Studio (1.60; MobDebug 0.648) on Windows 10.

I was fooling around with this and I made a change in configuration.lua and the program stopped working; same symptoms as with config.lua. So I tried again. I copied the project directory from the book into a different location on the desktop. In ZeroBrane, I tried running it and got the output below, but no game window.
Program starting as '"c:/moai-sdk/bin/moai.exe" "C:\Users\randall\Desktop\Nova pasta\concentration-code2\config.lua" "C:\Users\randall\Desktop\Nova pasta\concentration-code2\main.lua"'.
Program 'moai.exe' started in 'C:\Users\randall\Desktop\Nova pasta\concentration-code2' (pid: 5848).
Moai SDK 1.7 (ad hoc build by <unknown>)
Program completed in 1.06 seconds (pid: 5848).

I renamed the config.lua file to configuration.lua and changed the associated require statement in main.lua and ran the program. The game window opened and the I got the output below.Program starting as '"c:/moai-sdk/bin/moai.exe" "C:\Users\randall\Desktop\Nova pasta\concentration-code2\main.lua"'.
Program 'moai.exe' started in 'C:\Users\randall\Desktop\Nova pasta\concentration-code2' (pid: 3856).
Moai SDK 1.7 (ad hoc build by <unknown>)
No Joysticks connected.
TEXTURE: 'assets/tiles.png' is not a power of two (w:372, h:124)
TEXTURE: '+' 184512k = 0.18MB < assets/tiles.png
Program completed in 21.04 seconds (pid: 3856).

I did this 3 times.
I then did one very minor thing. In ZeroBrane, I opened the configuration.lua file. I placed the cursor at the beginning of the line "WORLD_RESOLUTION_X = 480". I didn't type anything and I didn't save anything. in fact, the save icon was unavailable (grayed out) because I hadn't changed anything. I then ran the program again and it didn't work. I got the output below.
Program starting as '"c:/moai-sdk/bin/moai.exe" "C:\Users\randall\Desktop\Nova pasta\concentration-code2\configuration.lua"'.
Program 'moai.exe' started in 'C:\Users\randall\Desktop\Nova pasta\concentration-code2' (pid: 5912).
Moai SDK 1.7 (ad hoc build by <unknown>)
Program completed in 1.05 seconds (pid: 5912).

Again, I didn't change anything and it stopped working. WHAT'S GOING ON!?!?!?!
rpallen
 
Posts: 3
Joined: Mon Oct 30, 2017 10:07 am


Return to Moai SDK

Who is online

Users browsing this forum: No registered users and 2 guests

cron

x