Scripts / A Case in point

Author
Message
benjiboy
7
Years of Service
User Offline
Joined: 24th Mar 2017
Location: In the depths of rural Norfolk
Posted: 20th Feb 2020 15:21
I'd like to request that for GG max, (preferable for GG too) that the lua interpreter be updated to match pretty much all modern languages and get rid of the 'all lowercase' script names. I have a very old coding head. COBOL didn't give a monkeys about case, nor did Fortran or Algol, nor BASIC in the early days. Then ASCII turned up and suddenly new vistas opened up for naming things.
I jumped on the bandwaggon with glee and followed all the modern naming trends.
Now I come to lua where I can't use Uppercase in Script Names.

Don't know about the rest of you, but when my head is full of logic that has to worked through, there's no space for niceties and naming stuff is put into the (formerly reliable) hands of my offline habitual processes capability, whilst I get on with the hard stuff.
Getting tripped up 'coz I named my version of another script Mywhatever.lua is a real drag.

You can't teach an old dog.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 20th Feb 2020 19:56
Nothing to do with the Lua interpreter, it's just that like most Windows applications filenames are not case sensitive. For windows DEFAULT.LUA, default.lua and DeFaUlT.LuA are all the same file.

Fall foul of this all the time in my work, transferring files around between unix and windows can cause absolute havoc!

Lee decided on lower case cos it is at least less ugly looking.
Been there, done that, got all the T-Shirts!
PM
benjiboy
7
Years of Service
User Offline
Joined: 24th Mar 2017
Location: In the depths of rural Norfolk
Posted: 20th Feb 2020 20:55 Edited at: 20th Feb 2020 21:07
@AmenMoses. Nope.

Yes Windows doesn't care about case in filenames but it will pass the file name through unaltered to the opening application.
Try creating MyNewAmenMosesScript.lua.
GG will not run it.
If it were as you say an o/s feature then GG would not care - it would get a lowercase filename.
The excellent lua guide on the Steam forum says quite clearly, (I wish I could force my subconcious mind to remember it - no - wait my subconcious mind does - it just doesn't bother informing my concious mind) 'TID-BIT: The version of LUA running with GameGuru requires that all LUA script file names be in all lower case or numbers. '
You can't teach an old dog.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 20th Feb 2020 21:26
It's not Lua, Lee decided to use lower case so GG calls your _init and _main functions in lower case. So if you have a script called MyScript.lua GG will attempt to call myscript_init and myscript_main functions.

Lua *is* case sensitive, try calling prompt( "Hello" ) and it will complain because the function is called Prompt().
Been there, done that, got all the T-Shirts!
PM
benjiboy
7
Years of Service
User Offline
Joined: 24th Mar 2017
Location: In the depths of rural Norfolk
Posted: 20th Feb 2020 22:07
Okay,
I did the test.
You can mix upper and lower case as you like in your script filename.
I got that bit wrong.
Apologies.

But, ( or should that be *BUT*)

Quote: "Lee decided to use lower case"


Why?
If there is a reason, then it escapes me.
I can use a mixed case filename but the routine names must be in lower case?
GG lua understands mixed case for function names and strings but *not* for _init and _main?

Please, Lee, for the sake of my sanity, tell me why?

It's not like we're going to be importing stuff from other platforms. . .
You can't teach an old dog.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 20th Feb 2020 22:13
Because of Windows!

Windows doesn't differentiate, the fact that newer versions like 7 and 10 retain the case doesn't really come into it, earlier versions didn't and GG comes from a code base way back when.

Been there, done that, got all the T-Shirts!
PM
benjiboy
7
Years of Service
User Offline
Joined: 24th Mar 2017
Location: In the depths of rural Norfolk
Posted: 20th Feb 2020 22:33 Edited at: 20th Feb 2020 22:44
Nope.
I tell the editor to use "MyLuaScript.lua" - which the editor accepts, (and preserves through future editing sessions).
GG passes "MyLuaScript.lua" to Windows, (or has it already, (perversly - and what I suspect may be happening) made it all lower case)?
Windows obliges and opens the file and passes the handle to GG.
GG reads the file and now demands that "MyLuaScript" be "myluascript".

Nonsense.

And *absolutely* a function of the lua interpreter.

The apparent inability to transmit a string accurately through the various bits of GG is - at best - worrying.

No. No. No. No. The restriction of _init and _main being all lowercase rather than reflecting the real filename, (which is itself an imposed restriction) is a restriction that has been imposed by Lee. Not by the operating system.
You can't teach an old dog.
benjiboy
7
Years of Service
User Offline
Joined: 24th Mar 2017
Location: In the depths of rural Norfolk
Posted: 20th Feb 2020 22:46
Whatever.
On a priorities scale of 1-10 for all the things that could/should be done to improve user experience of GG, this probably rates a .5
You can't teach an old dog.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 20th Feb 2020 22:48 Edited at: 20th Feb 2020 22:49
I'll try one last time then I give up.

In Windows there is absolutely no difference between upper case lower case or mixed case as far as the filer is concerned, in earlier versions of Windows in fact it would force files to upper case.

GG needs to know exactly what you functions are going to be called in order to call them, this is the Lua interpreter and it *must* have correct case.

So Lee forces lower case on purpose to overcome the crap Windows filer!
Been there, done that, got all the T-Shirts!
PM
benjiboy
7
Years of Service
User Offline
Joined: 24th Mar 2017
Location: In the depths of rural Norfolk
Posted: 20th Feb 2020 23:19
@AmenMoses. Don't get me wrong - I have the greatest respect for all the stuff you've done here.

But. Still. Nope.

Either GG turns 'MyLuaScript' into 'myluascript' before it asks windows to open the file, or, once it has the file open it does the same thing - causing the later fail on _init and _main.

It is the GG lua interpreter which insists that _init and _main have the same name as the file that contains them and It is either the GG editor or the GG lua interpreter failing to maintain the integrity of the supplied name which causes the problem. Not Windows. For once it is not Microsoft's fault.

You should give up.
You won't convince me.
Every other Windows based interpreter/compiler copes.
The only people who have the answer to this are the GG coders.
Let them do as they will with my request.
You can't teach an old dog.
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 21st Feb 2020 09:59
Quote: "Either GG turns 'MyLuaScript' into 'myluascript' before it asks windows to open the file,"

Something such us string.lower('MyLuaScript'), perhaps GG might do it.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM

Login to post a reply

Server time is: 2024-04-20 11:47:59
Your offset time is: 2024-04-20 11:47:59