string to code

Max Marin

  • Posts: 138

Hello I would need the way of a string to pass it to code like:


Code: [Select]
var mycode = "trace ('asd');";
execute(mycode);
I'm human

Luyren

  • *
  • Posts: 2769
Code must be compiled before your game can run. That is to say, what you are attempting is not possible in such a straight forward way. You can create a script parser of something or the sort as an alternative.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

yoplalala

  • *
  • Posts: 1632
Hi, Max Marin !

What is your intention ?
You can use a  haxe parsing library called hscript  https://github.com/HaxeFoundation/hscript  . Hscript is used by Stencyl itself, so you don't need to download it .

You have to put  <haxelib name="hscript" /> in your settings.


Max Marin

  • Posts: 138
I want to write code in a running game and have it run
I'm human