Exemplo n.º 1
0
static int l_get_method (lua_State *L) {
    MonoClass *clazz = (MonoClass*)lua_touserdata (L, 1);
    char const *method_sig = luaL_checkstring (L, 2);
    if (!clazz)
        luaL_error (L, "method can not be null.");
    MonoMethod *method = get_class_method (clazz, method_sig);
    if (method)
        lua_pushlightuserdata (L, method);
    else
        lua_pushnil (L);
    return 1;
}
Exemplo n.º 2
0
/*
 * mono.new(class, "ctor_sig", ...)
 * class 为MonoClass指针(userdata)
 * "ctor_sig" : 带有函数签名的.ctor 比如 : .ctor(int, int), 
 *              若使用默认构造函数(无参数), 该参数为空字符串
 * ... : 为构造函数所需实参
 * 返回 : MonoObject*(userdata)
 */
static int l_newobj (lua_State *L) {
    MonoClass *clazz = (MonoClass*)lua_touserdata (L, 1);
    luaL_argcheck (L, clazz != 0, 1, "class is null.");
    char const *ctor_sig = luaL_checkstring (L, 2);
    MonoMethod *ctor = get_class_method (clazz, ctor_sig);
    if (!ctor)
        luaL_error (L, "class %s can not find the %s.", mono_class_get_name (clazz), ctor_sig);
    MonoObject *obj = mono_object_new (mono_domain_get (), clazz);
    MonoObject *ex = 0;
    call_method (L, 3, obj, ctor, &ex);
    if (ex)
        luaL_error (L, "init the obj cause an exception!");
    lua_pushlightuserdata (L, obj);
    return 1;
}
Exemplo n.º 3
0
/****************************************************************************
*
* Name get_function
*
* Description Returns the function for the exception.
*
* Parameters None
*
* Error handling None
*
****************************************************************************/
string lcd6100_exception::get_function(void)
{
  return get_class_method(m_pretty_function);
}
Exemplo n.º 4
0
string excep::get_function(void)
{
  return get_class_method(m_pretty_function);
}