예제 #1
0
def receive_message(inter_ob, data, txt):
    global call_catch_tell

    if call_catch_tell is None:
        symbol_ob = ldmud.Symbol('ob')
        symbol_txt = ldmud.Symbol('txt')
        call_catch_tell = ldmud.efuns.unbound_lambda(
            ldmud.Array((
                symbol_ob,
                symbol_txt,
            )),
            ldmud.Array(
                (ldmud.Closure(ldmud.get_master(), "efun::call_resolved"),
                 ldmud.Array((ldmud.Closure(ldmud.get_master(),
                                            '&'), ldmud.Symbol('result'))),
                 symbol_ob, "catch_tell", symbol_txt)))

    current_ob = ldmud.efuns.this_object()
    if current_ob == inter_ob or not ldmud.efuns.bind_lambda(
            call_catch_tell, current_ob)(inter_ob, txt):
        data.call_control_ob("receive_message", inter_ob, txt)

    if data.snooper is not None:
        try:
            ldmud.efuns.tell_object(data.snooper, "%" + txt)
        except:
            pass
예제 #2
0
파일: startup.py 프로젝트: leodotng/ldmud
 def testSymbolEq(self):
     s1 = ldmud.Symbol("sym", 2)
     s2 = ldmud.Symbol("sym", 2)
     s3 = ldmud.Symbol("sym", 5)
     s4 = ldmud.Symbol("sym2", 2)
     self.assertIsNotNone(s1)
     self.assertIsNotNone(s2)
     self.assertIsNotNone(s3)
     self.assertIsNotNone(s4)
     self.assertEqual(s1, s2)
     self.assertNotEqual(s1, s3)
     self.assertNotEqual(s1, s4)
예제 #3
0
파일: startup.py 프로젝트: leodotng/ldmud
 def testSymbolInitQuotes(self):
     s = ldmud.Symbol("sym", 5)
     self.assertIsNotNone(s)
     self.assertEqual(s.name, "sym")
     self.assertEqual(s.quotes, 5)