Mercurial Hosting > luan
comparison core/src/luan/LuanState.java @ 300:9fb523472035
add java() to control java access
git-svn-id: https://luan-java.googlecode.com/svn/trunk@301 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Tue, 16 Dec 2014 13:13:33 +0000 |
parents | a74559240b4f |
children | a6bf8ff720f8 |
comparison
equal
deleted
inserted
replaced
299:a74559240b4f | 300:9fb523472035 |
---|---|
25 | 25 |
26 protected LuanState() { | 26 protected LuanState() { |
27 registry = new LuanTableImpl(); | 27 registry = new LuanTableImpl(); |
28 global = new LuanTableImpl(); | 28 global = new LuanTableImpl(); |
29 global.put("_G",global); | 29 global.put("_G",global); |
30 global.put("java",JavaLuan.javaFn); | |
30 metatable = newMetatable(); | 31 metatable = newMetatable(); |
31 } | 32 } |
32 | 33 |
33 protected LuanState(LuanState luan) {} | 34 protected LuanState(LuanState luan) {} |
34 | 35 |
50 | 51 |
51 public static LuanState newStandard() { | 52 public static LuanState newStandard() { |
52 try { | 53 try { |
53 LuanState luan = LuanCompiler.newLuanState(); | 54 LuanState luan = LuanCompiler.newLuanState(); |
54 PackageLuan.require(luan,"luan:Basic"); | 55 PackageLuan.require(luan,"luan:Basic"); |
56 PackageLuan.require(luan,"luan:Io"); | |
55 // BasicLuan.do_file(luan,"classpath:luan/init.luan"); | 57 // BasicLuan.do_file(luan,"classpath:luan/init.luan"); |
56 return luan; | 58 return luan; |
57 } catch(LuanException e) { | 59 } catch(LuanException e) { |
58 throw new RuntimeException(e); | 60 throw new RuntimeException(e); |
59 } | 61 } |