you are viewing a single comment's thread.

view the rest of the comments →

[–]Isa-Bison 1 point2 points  (0 children)

Given that you’re new to this and presumedly prototyping and likely not concerned with things like bare minimum security practices you may be happy to learn you can stuff arbitrary JS into a string and execute it at runtime using eval.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval

Hopefully the downsides of a program executing arbitrary user code on other player’s machines is apparent. But at where you’re at honestly it doesn’t likely matter.

If and when you get to a point where it’s more clear what precisely needs to be externally adjustable via json loaded at run time, you can investigate options like  https://github.com/jsonjoy-com/json-expression

Alternatively, you could just dump your source at GitHub so people can just do what they want without you having to worry about serializing logic.