using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using LuaInterface; // lua 封装库 namespace _10Test
{
public partial class Form1 : Form
{ public Lua lua = new Lua(); public Form1()
{
InitializeComponent();
} class MyClass // 自定义类
{
public string MyStr(string s) // 自定义功能函数
{
return s + " World !";
}
} private void button1_Click(object sender, EventArgs e)
{
MyClass my = new MyClass();
// 在lua虚拟机(全局)中注册自定义函数,一边在lua文件中调用该函数
lua.RegisterFunction("MyStr", my, my.GetType().GetMethod("MyStr"));
lua.DoFile("Test.lua");
object[] objs = lua.GetFunction("MyNum").Call(textBox1.Text,textBox2.Text);
foreach (var s in objs)
MessageBox.Show(s.ToString());
}
} }

LuaToC#的更多相关文章

随机推荐

  1. kubernetes调度之资源耗尽处理配置

    系列目录 本篇将介绍如何使用kubelet处理资源耗尽的情况 当可用的计算机资源非常低的时候,kubelet仍然要保证节点的稳定性.当处理不可压缩的计算机资源(比如内存或磁盘空间)时,这尤其重要,当这 ...

  2. Ubuntu引导出问题grub rescu模式下:“error : unknown filesystem”或者 找不到normal.mod 的解决办法

    感谢http://www.linuxidc.com/Linux/2012-06/61983.htm,因为参考了其中的内容. 下面是修改和完善. 问题原因: (win7,ubuntu双系统下) 强制关机 ...

  3. Core Data 版本号迁移经验总结

    大家在学习和使用Core Data过程中,第一次进行版本号迁移的经历一定是记忆犹新,至少我是这种,XD.弄的不好,就会搞出一些因为迁移过程中数据模型出错导致的Crash.这里总结了一下Core Dat ...

  4. bzoj-2251 外星联络

    题意: 给出一个字符串,求出现次数超过1的子串的出现个数. 字符串长度<=3000: 题解: 题目问的是子串的个数.那么首先我们要找到全部的子串. 而字符串的全部后缀的前缀能够不重不漏的表示全部 ...

  5. 【BZOJ1042】[HAOI2008]硬币购物 容斥

    [BZOJ10492][HAOI2008]硬币购物 Description 硬币购物一共有4种硬币.面值分别为c1,c2,c3,c4.某人去商店买东西,去了tot次.每次带di枚ci硬币,买si的价值 ...

  6. Problem binding to [bigdata-server-01:9000] java.net.BindException: Cannot assign requested address;

    If the port is "0", then the OS is looking for any free port -so the port-in-use and port- ...

  7. Jquery AJAX如何使用Promise/Deferred实现顺序执行?

    有的时候有我有N个AJAX请求,第下个请求可能要依赖上个请求的返回值, 可以用 $.ajax("test1.php").then(function(data) { // data ...

  8. Impala 安装笔记3一impala安装

    安装impala之前,确认满足Cloudera Impala Requirements中要求的所有条件: Supported Operating Systems Supported CDH Versi ...

  9. CentOS(Linux) - 安装软件笔记(一) - VPSMate(服务器可视化管理工具)安装

    更多详情点击参考官网说明 vpsmate官方推荐centos版本为6.2 64位 使用 SSH 连接工具,如 PuTTY.XShell.SecureCRT 等,连接到您的 Linux 服务器. 执行以 ...

  10. Codeforces Round #383 (Div. 2) D. Arpa's weak amphitheater and Mehrdad's valuable Hoses —— DP(01背包)

    题目链接:http://codeforces.com/contest/742/problem/D D. Arpa's weak amphitheater and Mehrdad's valuable ...