LOVE Programming Game
Posted: Mon Jul 09, 2012 5:23 pm
Hi guys,
I'm planning on developing a little 2d sidescroller, where a robot has to make his way through obstacles, enemies, pitfalls, etc.
However, instead of the user directly controlling the robot, he must write a lua script file, which invokes some void functions such as: goLeft(), goRight(), jump(), etc.
I thought about doing this using lua's 5.1 "loadstring" or "loadfile" and then evaluating the string/file, but how should I stop the user from calling something "os.remove("c:/windows/system32")" or accidentally incrementing the delta-time variable dt or in any way write a harmful script?
What I'm really asking is how can I create a sandbox in which interaction is possible only with my robot module and not the os module or the love module etc.
This might seem as a noob question, but seeing how i am no love/lua guru I'll ask it anyway.
Thanks.
I'm planning on developing a little 2d sidescroller, where a robot has to make his way through obstacles, enemies, pitfalls, etc.
However, instead of the user directly controlling the robot, he must write a lua script file, which invokes some void functions such as: goLeft(), goRight(), jump(), etc.
I thought about doing this using lua's 5.1 "loadstring" or "loadfile" and then evaluating the string/file, but how should I stop the user from calling something "os.remove("c:/windows/system32")" or accidentally incrementing the delta-time variable dt or in any way write a harmful script?
What I'm really asking is how can I create a sandbox in which interaction is possible only with my robot module and not the os module or the love module etc.
This might seem as a noob question, but seeing how i am no love/lua guru I'll ask it anyway.
Thanks.