Does Lua run on Game consoles such as Xbox One and PS4.

Hi I’m making a 2D game engine that can be used on all windows 10 devices. My goal is to be able to make games on both Windows 10 Desktop and Windows 10 mobile. So far so good but I’m stuck on what to use as my scripting language. I need it to work on Windows, Linux, MacOS, Windows Mobile, Xbox One(PS4 would be nice but not needed), iOS and android. I looked into lua but I can find out if it works on mobile and console devices.

From this page it seems like Lua will work but does it support consoles. I whould think it whould run on Xbox One due to Windows 10 apps run the same everywhere and Xbox one is running Windows 10 in the near future.

Whould Lua work as my scripting language or is there a better alternative?

Lua is supplied as C source code, so it just requires you to build it for the target platform using the native compilers for that platform. Then you would need the Lua C# bindings, and you should be able to run Lua scripts. Then comes the task of adding hooks into your code for Lua scripts to call.

Why not just use C# for scripting?

Because I cant compile it on Windows Mobile right? My engine has an editor which is used to make the game and I want it to work both on Windows Mobile and Windows 10 Desktop devices.

@nickkorta For .NET languages (C#, Visual Basic, etc) on platforms without Reflection.Emit you would need to compile the scripts when the project is compiled. If a platform does not support Reflection.Emit (iOS for example) then you won’t be able to load and run arbitrary, non compiled code while the game is running.

Ok I got something working. I’m using MoonSharp which is a lua interpreter for C#. It works great. First time using Lua ad within 2 hours I got moving and drawing a character thorough LUA and it works on Windows Phone 10. Works on android and iOS as well as long as I’m careful on what I do with LUA. Should work with Xbox One due to UWP apps running on it. As for Ps4 It should also work since MoonSharp supports Unity and Unity can export to Ps4.

As for porting to different platforms my all I have to do is make a new Monogame Project for the specific Program, add my engine code, replace Game 1 with my Custom Game Class , and add my Project Files and it works. Not to much work.

Does it build the lua files into xnb binary files?

Or are the editable anytime and the game interprets them at runtime?

Generally the Lua scripts are loaded into the Lua runtime and compiled at load time into bytecode. The Lua interpreter then executes the bytecode.

I see, I have just been doing some research and it seems that the consensus is to use C# as the “scripting language”.

What I asked above it seems more like an XML or txt script that you just file open and read and serialize into commands. Again it seems C# itself is preferred over using a custom XML script.