LuaToC#
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#的更多相关文章
随机推荐
- openh264 在 osx 上的 nasm 问题
先在 pc 上编译,熟悉一下. 编译遇到一个问题: nasm -DUNIX64 -DPREFIX -f macho64 -I./codec/common/x86/ -o codec/common/x8 ...
- adb的经常使用命令(android debud bridge)
android调试桥: adb命令使用须要在系统环境遍历中path中追加adb.exe的完整路径D:\IDE\adt-bundle-windows-x86-20130729\sdk\platform- ...
- C语言的面向对象设计之 X264,FFMPEG 架构探讨
FFMPEG架构分析 使用面向对象的办法来设想这样一个编解码库,首先让人想到的是构造各种编解码器的类,然后对于它们的抽象基类确定运行数据流的规则,根据算法转换输入输出对象. 在实际的代码,将这些编解码 ...
- ContentPresenter理解
这是2年前写了一篇文章 http://www.cnblogs.com/Clingingboy/archive/2008/07/03/wpfcustomcontrolpart-1.html 我们先来看M ...
- EasyRTMP实现Demux解析MP4文件进行rtmp推送实现RTMP直播功能
本文转自EasyDarwin团队Kim的博客:http://blog.csdn.net/jinlong0603/article/details/52965101 前面已经介绍过EasyRTMP,这里不 ...
- ickeck插件
地址:http://www.bootcss.com/p/icheck/#skins 使用 1. 先引入文件 css <link rel="stylesheet" type=& ...
- Javascript学习之Function对象详解
JavaScript中的Function对象,就是我们常说的函数对象.在JS中,所有的函数也是以对象的形式存在的. 语法 充当Function对象的构造函数使用,用于结合new关键字构造一个新的Fun ...
- Linux环境下安装ActiveMq
一.准备安装的tar包 1.将安装包放在服务器上:apache-activemq-5.10.2.tar.gz 2.将安装包解压:tar -zxvf apache-activemq-5.10.2.tar ...
- 【LeetCode】Search in Rotated Sorted Array II(转)
原文链接 http://oj.leetcode.com/problems/search-in-rotated-sorted-array-ii/ http://blog.csdn.net/linhuan ...
- java.lang.ClassNotFoundException: Didn't find class "org.reactivestreams.Publisher" on path
缺少jar包 reactive-streams-1.0.0.jar 和 reactive-streams-1.0.0-sources.jar 常用于 Rxjava 开发过程中 <?xml ...