scripting-language

Python lambda function printing <function <lambda> at 0x7fcbbc740668> instead of value

十年热恋 提交于 2019-12-01 05:45:43
I am a beginner in python, and I was playing around with lambda functions. I was writing a program using lambda function to print characters that are +1 the ascii value of the input characters. My code is #!/usr/bin/python import sys try: word = sys.argv[1] except: print "No arguments passed" sys.exit(1) def convert_ascii(char): return "".join(chr(ord(char) + 1)) for i in word: print convert_ascii(i) print lambda x: chr(ord(i) + 1) I have a function convert_ascii that does the same thing as lambda. However, my output is /usr/bin/python2.7 /home/user1/PycharmProjects/test/Tut1/asciipl2.py "abc

Implementing a simple XML based Scripting Language for an XNA Game

只谈情不闲聊 提交于 2019-12-01 01:50:49
I'm working with a team on a RPG engine in C# and XNA. We're planning on targeting Windows and Windows Phone 7, but are running into issues with AI interactions and controlling player actions during cutscenes. FOr the most part, everything is extracted using the MVC design pattern, but abstracting all logic and movement into a controller could cause issues down the line. So the idea is to have an interface (IScriptEngine) that takes an IScriptObject and updates data in the map model accordingly. I was thinking about putting the scripts in an XML sort of syntax: <Script Name="MoveNPC_1">

Scripting Language in a Sandbox for a C#/.NET Application

拟墨画扇 提交于 2019-11-30 14:37:18
[This question is similar to this one , but I am also interested in the possibility of a sandbox.] I am considering embedding a scripting language in my C#/.NET application and then exposing some of my application's API to the scripts. There seem to be multiple good options for this (Lua, Boo, IronPython, etc.), but are there easy options for restricting the scripting language's built-in functions from being used? For example, I do not want the scripts to be able to perform I/O except through the API that I explicitly expose, so no printing to the console, opening files, etc. Do any of these

Scripting language for C++ [closed]

会有一股神秘感。 提交于 2019-11-28 04:20:33
I'm getting a little rusty in scripting languages, provided they're popping like mushrooms lately :) Today I thought that it would be nice to have a scripting language that talks seamlessly to C++, that is, could use C++ classes, and, the most important for me, could be compiled into C++ or some DLL/.SO (plus its .h) so that I could link it into my C++ program and make use of the classes the script defines or implements. I know I could embed any popular scripting language such as lua, ruby, python... but the interface usually includes some kind of "eval" function that evaluates the provided

Is there a “safe” subset of Python for use as an embedded scripting language?

a 夏天 提交于 2019-11-27 08:25:53
In the many Python applications I've created, I often create simple modules containing nothing but constants to be used as config files. Additionally, because the config file is actually a Python code file, I can add simple logic for changing variables depending on a debug level, etc. While this works great for internal applications, I'd be wary about releasing such applications into the wild for fear of someone either accidentally, or maliciously, adding destructive code to the file. The same would hold true for using Python as an embedded scripting language. Is there a subset of Python that

Suggestions for writing a programming language? [closed]

↘锁芯ラ 提交于 2019-11-27 07:28:59
What tips can you give a person who is looking to write a programming or script language? I am not worried about how to program nor design a compiler but how to develop one quickly using tools and code generators. Last time i tried i coded it in c++ and the states and syntax took almost as long as writing the actual logic. I know the follow tools would help. I was thinking i could generate c++ code and have gcc compile that. Using the tools above how long would you estimate it would take to write a program or script language? Variations on this question have been asked repeatedly, as far back

Copy a list (txt) of files

走远了吗. 提交于 2019-11-27 03:12:20
I've seen some scripts examples over SO, but none of them seems to provide examples of how to read filenames from a .txt list. This example is good, so as to copy all files from A to B folder xcopy c:\olddir\*.java c:\newdir /D /E /Q /Y But I need something like the next, where I can fill actually the source and destination folder: @echo off set src_folder = c:\whatever\*.* set dst_folder = c:\foo xcopy /S/E/U %src_folder% %dst_folder% And instead of src_folder = c:\whatever\*.* , those *.* need to be list of files read from a txt file. File-list.txt (example) file1.pds filex.pbd blah1.xls

Scripting language for C++ [closed]

六眼飞鱼酱① 提交于 2019-11-27 00:21:00
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I'm getting a little rusty in scripting languages, provided they're popping like mushrooms lately :) Today I thought that it would be nice to have a scripting language that talks seamlessly to C++, that is, could use C++ classes, and, the most important for me, could be compiled into C++ or some DLL/.SO (plus

Scripting Language vs Programming Language

两盒软妹~` 提交于 2019-11-26 18:02:48
Can anyone explain the difference between Scripting Language and Programming Language please? Also can you state some examples for each. I have Googled a lot but I always find the best answers from Stack Overflow. Scripting languages are programming languages that don't require an explicit compilation step. For example, in the normal case, you have to compile a C program before you can run it. But in the normal case, you don't have to compile a JavaScript program before you run it. So JavaScript is sometimes called a "scripting" language. This line is getting more and more blurry since

Is there a “safe” subset of Python for use as an embedded scripting language?

萝らか妹 提交于 2019-11-26 17:45:55
问题 In the many Python applications I've created, I often create simple modules containing nothing but constants to be used as config files. Additionally, because the config file is actually a Python code file, I can add simple logic for changing variables depending on a debug level, etc. While this works great for internal applications, I'd be wary about releasing such applications into the wild for fear of someone either accidentally, or maliciously, adding destructive code to the file. The