Page MenuHomeFeedback Tracker

Lua Support
New, WishlistPublic

Description

Is there any chance that the support for Lua Scripting is soon given? {F21364}

Details

Legacy ID
2500662759
Severity
None
Resolution
Open
Reproducibility
Always
Category
Scripting

Event Timeline

DypoX edited Steps To Reproduce. (Show Details)Aug 11 2013, 9:56 PM
DypoX edited Additional Information. (Show Details)
DypoX set Category to Scripting.
DypoX set Reproducibility to Always.
DypoX set Severity to None.
DypoX set Resolution to Open.
DypoX set Legacy ID to 2500662759.May 7 2016, 3:58 PM

Here, take this ticket and stand over there, behind that Java crowd :)

DypoX added a subscriber: DypoX.May 7 2016, 3:58 PM
DypoX added a comment.Aug 12 2013, 3:59 AM

I don't think Java is the right programming language to program mods for Arma 3.

Any kind of proper scripting language would be a vast improvement. The current one has the comfort level of assembler.

Upvoting because it would be nice, but I really think they can't do that in the near future, it would require a complete change in the game's engine.

It wouldn't require a complete change, they are (from what I've heard) doing a Java API, and because of that they'd only have to expose the functions of the Java API to a Lua VM (maybe with a few minor changes). Lua is, in my opinion, a
much better choice than Java, just for the reason that you'd have to compile Java every time you want to change behaviour of your Program. Lua also integrates better with C/C++ and is more flexible and less heavy-weight than Java, because Lua doesn't need a complete runtime environment installed (as opposed to Java). Upvoted.

I think the dev's should choose any (proper) language they deem appropriate as long as it's not this **** SQF anymore.

Why so much hate towards SQF? Oh yeah because it is different.

dezkit added a subscriber: dezkit.May 7 2016, 3:58 PM

Because SQF looks like it was made by toddler

@Killzone_Kid Look, somebody even bothered to write an article about some of the problems: http://s0beit.me/scripting/quick-critique-arma-series-scripting-language/

But I think the programmers have realized this already. They must have experienced physical pain writing that functions library.

@wallside Thanks man, pretty entertaining :)

A subjective article with bad examples full of errors (looks like he took some bad code from other people as examples). Yes, you cannot learn SQF overnight and it is pretty different from other languages but it is far from clusterfuck of a language.

"clusterfuck of a language" sounds like a good description to me.

"pretty different from other languages" is however not true. Apart from some syntactic nonsense (as putting parameters randomly in front and behind of calls) it's pretty much like many old imperative languages minus 90% of the featureset.

You are obviously not a programmer or I would not have to argue about this.

You obviously know me very well to say shit like this.

Whoever wrote that article is an idiot and has absolutely no idea what he's talking about.

And I'd much rather keep SQF than depend on the JRE.
And lua wouldn't add anything.

s0beit added a subscriber: s0beit.May 7 2016, 3:58 PM

Hello friends.

I'm the guy who wrote that article, thanks for linking it. I updated some of the outdated information in the article to reflect the current state of affairs.

@MulleDK19: I never said that I'd prefer the JRE and neither does this ticket.

@Killzone_Kid: Though I took "bad code" from other people as examples, the syntax and not the logic of that specific script is what I was critiquing. Whether it operated well or not has no impact whatsoever on how terrible the syntax is.

"Yes, you cannot learn SQF overnight and it is pretty different from other languages but it is far from clusterfuck of a language."

If you can find me an employed programmer who says "Yeah, okay, this language looks legit" I'll buy you a fucking Christmas cake.

How about if I find you a programmer who doesnt think sqf is clusterfuck, will I get the cake?

How about: One that would use SQF for development purposes if it were capable of it. Core web technology, client applications - anything that isn't a ARMA.

If you can show me one of those I'd really enjoy talking to them and digging around in their brain a bit.

Why would anyone want to use arma specific language for web development? Whould you use html to make scripts for arma? Somehow I doubt it. Anyway, this is wrong place for trolling, BIS forums are this way -->

It's not trolling - if SQF is powerful, has ease of use, there's be no reason to not want it in other situations.

I like Lua, I have used it in other environments and my friends in other industries deploy Lua to their servers and bind it to their projects so they can easily change things and reload configurations. It is used in enterprise environments because it is so light and fast.
It has a good syntax, great error handling, it is OOP to an extent and it is internally consistent in it's results.

Saying "This language is GREAT for a game, but I'd never use it for anything serious" requires a lot of cognitive dissonance to pull out on somebody.

If it's not fast, if it doesn't have a great syntax, if it doesn't have great error handling, if it is an inconsistent mess; like SQF for example, you wouldn't want to deploy it anywhere else.

There is nobody sane heaping praises onto this language.
It is not good.
It is not ideal.

jaemn added a subscriber: jaemn.May 7 2016, 3:58 PM
jaemn added a comment.Jan 2 2014, 1:45 AM

SQF has a number of flaws:

  • It is verbose, in a way that hurts readability.

Consider the readability of:

_a set [_i, (_b select _j) call someFunc]
[_a call funcB, [_b, _c] call funcC] call funcA

Compared to the readability of:

  _a[_i] = someFunc(_b[_j])
  funcA(funcB(_a), funcC(_b, _c))
  • Since arguments to functions are simply passed as arrays (or, more accurately, functions take a single argument that is usually an array), it is up to the programmer to manually validate the presence of each argument, to provide default values for missing arguments (when appropriate), and to produce errors when arguments are not present. This leads to most functions requiring quite a bit of boilerplate.

In order to determine what the arguments to a function are, a programmer is forced to either examine the body of the function, or to read documentation provided for the function (assuming there *is* documentation, and that it is accurate). In the majority of languages, a quick look at the function declaration will suffice.

I don't feel like Lua does a good job here either, but it does a better job than SQF. If nothing else, it is at least possible to customize Lua's behaviour through the use of metatables and closures.

  • SQF provides no way to create user-defined classes. Outside of pure C, I can't remember the last time I used a programming language in which this was the case. Lua provides this functionality through the use of metatables, and it works quite well.
  • SQF provides anonymous functions, but fails to provide closures, which is something that nearly all modern scripting languages provide. If a function refers to variables located outside of its body, but inside the lexical scope in which the function was created, then that function will fail to work correctly when executed in an environment in which those variables have passed out of scope.
  • Creating a sensibly scoped local variable requires both a declaration ('private'), and the use of a sigil ('_'). This is a minor annoyance, but there is really no reason to require both. The current behaviour with just the sigil is useless, and is a recipe for subtle bugs.
X39 added a subscriber: X39.May 7 2016, 3:58 PM
X39 added a comment.Mar 12 2014, 5:37 PM

@Killzone_Kid
i know youre pretty experienced but even you need to accept that its true
SQF is not a good script language

many things of modern languages are just missing (just lets take as example a simple "return BLABLAVALUE" command)

dont missunderstand me! I really enjoy that ArmA even has the ability to mod but it still is pain in the ass to code as 100000000 things are just handling much different then in usual languages (Java, C/C++, C#, Lua) and even SQF itself is not at all points consistent (lets take the thing that "_array = _array + [1]" is much slower then "_array set [count _array, 1]" which is kinda stupid if you see (and yes ^^ i know that the _array + [1] is generating a new array assigning it to the old one and destroying the old one! but its still frking stupid as it could be MUCH more simple))!

(((gnargh ... got about 300 mistakes in the upper text ...)))

kindly regards X39
PS
upvoted just to get rid of SQF
every language is better then the current (why dont give us a full range of C/C++ headers ^^ also would be funny to handle with memory leaks :F)

@X39 Seriously, you use array operations as an example to show awkwardness of SQF in favour of Lua. So I looked up Lua on wikipedia...

"array = { "a", "b", "c", "d" } -- Indices are assigned automatically.
print(array[2]) -- Prints "b". Automatic indexing in Lua starts at 1.
print(#array) -- Prints 4. # is the length operator for tables and strings.
array[0] = "z" -- Zero is a legal index.
print(#array) -- Still prints 4, as Lua arrays are 1-based."

Arrays start at 1 whereas everywhere else they start from 0. You can use index 0 but it will not be counted. This is even more confusing for someone who knows a thing or two from other languages. Also Lua is the only scripting language from all examples you gave.

Think SQF is somewhat readable (as it is similar to C or SH/Bash syntax), but I agree it does have it's quirks making readability difficult at times.

Also needs better documentation. When writing a program/script in any language, a person with past programming skills should be able to fluently write in a new language with good progress or with little difficulty. I found SQF seemed to have a lot of hurdles as I was trying to learn it.

Should also start from the ground-up like Linux, and code a decent terminal into the game versus doing everything via click & play. I end-up issuing more clicks versus just using a keyboard or terminal at most times. But a Windows' program can only get as good as it's operating system it's run from!

Just be thankful it's not it's not as bad as Perl! (*Cough* Python.)

X39 added a comment.Mar 12 2014, 11:11 PM

@Killzone_Kid
im not for LUA at all (me personally: Java, C/C++ as script lang.)
i just dont want SQF (the main thing i really hate it is because of the missing return ... its just ... GNARHGH -.-* no return ...)

yes ^^^ documentation really is the key. sqf has its quirks, like -all- languages. The difference being its not common, and you can't lookup 10000 ways to accomplish a task by googling. thus all learning stops with the wall we all know well, "fuck this, its too hard. {x} is a stupid language. whos idea was this??".

not knowing a command exists (or wiki wont give it up), or have documentation with incorrect parameters or returns is extremely frustrating, beyond just learning to interact with the uniqueness of arma (a challenge alone). It forces bad implementation and practices, and gives the appearance that sqf is broken and bad, when in reality it just requires a mixture of self-education, practice and art.

(Thats not to say there isn't a TON of info in the wiki, its just more like a api reference than a place to learn; and quite fragmented)

i'll pass on lua, please.

@X39 return is so so easy to add, it would be worthy command. In fact I suggest you make a feature request for it.

It should combine breakTo and exitWith, so that main scope is exited from anywhere once return is used

return ANY;

nobrainer really

Personally I would prefer either Python, the JVM (for Clojure and Scala) or the .NET framework (for F#) as the scripting implementation of choice.

That being said, even with its 1-based array silliness, complete lack of bitwise operators, and somewhat verbose syntax, I would still happily take Lua over what we have now. We would have proper closures, data types beyond numerically-indexed lists, sensible scoping rules, and a non-infix syntax for invoking functions.

What you guys likely do not likely realize and from what I've seen from the ARMA scripting language, the scripting language appears to be a very stripped down version of the Bourne shell with C like syntax. The likely rational, make the scripting as small and light as possible, while providing a useful scripting interface instead of C/C++ only interface.

A good example of tracing a computer language's history, or implementation and design; See "History of Python: 7. Influences from other languages"

I say; Continue to keep ARMA's scripting small and light, but it definitely needs a terminal for command line history and for easier debugging. (ie. Build from the ground-up, or give me terminal console access versus only a graphical interface which requires redundant reloading or retyping/reclicking. ;-)

Likely; the scripting language does need the previously mentioned fixes, or features implemented, or clean-ups.

To fully implement Python, would likely incur significant more overhead. (ie. I see a big difference in system resource usage between using SH/Bash and Python on a Pentium 3 CPU.) Today's four core & four threaded CPU's do not immediately display any slow-down, but the slow-down (or system resource usage) will be evident with the overall ARMA game usage alongside something like a full implementation of Python. (Python scripts would also need to be byte-coded or compiled for speed.)

dedmen added a subscriber: dedmen.EditedSep 13 2017, 3:06 PM

Sub-projects of Intercept are working on Python and LUA scripting.
https://github.com/intercept/intercept