how do i create a programming game a la colobot

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By XavierH622

I’m trying to create a programming game a la colobot.

how do i embed lua such that i can run lua scripts created by the player?
and have them effect gameplay?

EDIT: i also want to create custom Lua functions that call GDscript functions so that lua scripts can effect gameplay.

:bust_in_silhouette: Reply From: w411-3

Embedding the entire actual language of Lua would be complicated and really just unsafe. An entire general purpose language does not belong in a container for use with a game.

This is probably why Colobot uses its own language CBot. They have control over what CBot can do and it doesn’t pose security risks if it never tries to call actual OS functions. You are probably best off learning a bit about language syntax, parsing, and implementation; use that to build your own language that just looks a lot like Lua. The details of syntax visually are not that complicated; the actual implementation might be.

Anyway, it would be a lot of scripting and studying language theory, but I almost guarantee there are lots of free courses out there on building your own basic language; all you would have to do is translate their theory to gdscript, and do so with lua syntax in mind.