Why didn't you learn LUA script yet?

Lua is the best script language ver.

Runs as fast as C++.

Pratically a standard with games.

>array start at 1
but it is pretty decent for game scripting
used it to write mod for factorio

>LUA script
did you just learn about Lua today because it's not LUA script

>Runs as fast as C++

>script
>runs as fast as C++

Wrong. LUA executes bytecode at best. C++ is compiled and runs closer to metal.

lua jit

Literally uma delĂ­cia.

I use it for this.

Say I'm writing a game in C++, how do I into Lua? Can I integrate it?

Yes, literally just plop it the dll/so and initialize a lua environment and open the libraries you need. Open a lua file in the environment and its running.

m_State = luaL_newstate();
luaopen_base(m_State);
luaopen_debug(m_State);
luaL_loadfile(m_State, "file.lua");

Thats literally it.

What are LUAs advantages over the glorious python?

Don't forget you need to bind functions too, silly.

...

>Runs as fast as C++.
I kek'ed

Bro it's not nearly as fast as C++. Not even close. That's why game engines are writen in C++ and not lua if they need any kind of performance.

Most projects that use lua, use it as a scripting environment on top of the proper engine, in order to let less skilled programmers write in stuff that isn't speed sensitive, or that is subject to change.

Example:
Render a frame - C++

Decide whether entity is in the right faction - Lua.

Literally the only time I've ever considered Lua was when I was going to make mods for Garry's Mod.

I think I've seen one other piece of software that uses Lua and that's about it.

True but technically you dont need those to run Lua. It would be just a little useless in your project.
Define your function like this:

int luaFunction(lua_State *LState)
{
return 0;
}

And bind it like this:

lua_pushcfunction(m_State, luaFunction);
lua_setglobal(m_State, "yourFunctionNameInLua");

Basically every game that exposes an api for addons uses lua to do it.

Also if you've got civ 5 or 6 you should have a look at just how much of that is written in lua. It's all just lying around in plaintext so go nuts.

they should really add a continue statement

That's a really fun thing with gaming scripting engines, so many leave the source code lying around unobstructed

>be AAA game company
>pay for expensive high end DRM solution
>obfuscate code all to hell
>leave fucktons of source code in install folder for all to see.

Really? They don't compile it?

Wtf do you wanna compile in Lua. I mean you could make it load the bytecode but still.

A lot of the time they compile it on the fly before use.

It's not slow as balls.

I mean, if you used Python as a way to dial into C bindings the way Lua did, it might be a good bit quicker. Not sure how you'd set this up with Python, but I'm sure someone's tried it.

Python uses a stack-based interpreter which on average tends to be slower. If your just calling native functions all the time though, the difference is likely negligible.

Of course there's still PyPy, but then again your going up against LuaJIT. ;)

>Wtf do you wanna compile in Lua
lexing and parsing is the slowest part in language processing
I suppose AAA game developers don't care about initialization speed

Uhh definitely not. She runs fast, but shut *still* don't start fast.

The way most games use Lua involves mapping lua onto their native API, so the python calling native code example is apt.

>She runs fast, but shut *still* don't start fast.
When compiled to bytecode the only overhead is mmaping the file, which is very fast.

>initialization speed
Its a few kilobytes of text, it takes milliseconds to allocate, load and process. This isnt a DLL with shitton of overhead where you have to wait for the OS. Loading it as bytecode wouldnt really make it faster.

Just stop posting.

Because it's a shit language AND has shit libraries\modules\whatever the fuck.

C# is superior in every way.

Because I'm busy learning Fortran and C

>Pratically a standard with shit games like Rasenmähersimulator or Factorio and shit engines like CryEngine whose devs were too lazy to use/create a game specific scripting language.

>Runs as fast as C++
Even if that was true, and even with LuaJIT it isn't in real-world scenarios, it would be pointless, because requiring fast scripting interpreters is a mistake in the first place.

>tfw learned lua just to make homebrew for PSP

Because I already know how to program in FORTH.

SOPA DE MACACO

>use/create a game specific scripting language.
Why would you even want to do this?

this