Label: ♦english ♦feature planning

[259] sharing vars between scripts

Comment
Hi,
how can I share a variable between 2 scripts in an embedded environment? For example: script 1:
global_var  :  int  =  5;
script 2:
io.writeln(global_var)
In the C++ code I load both scripts into the daoVm. I would like to share vars between them. This is done by :
DaoVmProcess_Eval(  vmp,  ns,  src,  1  );
DaoVmProcess_Eval(  vmp,  ns,  src2,  1  );
where src is script 1 and src2 is script 2. Currently I don't see a way to do it. Even if I import script 1 in script 2 the global_var isn't known. Like: script 2:
import  script  1;
io.writeln(global_var)
Regards.
Comments
Ok, I found it. It can be so easy by reading the documentation :-). I have overseen the keyword global. Thanks.

Change picture:

Choose file:

123 4
56 78910 11
121314151617 18
192021222324 25
26272829

fu: ... I forgot to say something about the plan for the whole new year in my previous reply. Well, besides w ... (Jan.19,01:40)

fu: ... Happy new dragon year (which will start from this sunday)! Actually, it was a busy month (I wish th ... (Jan.18,22:46)

ybabel: What's the plan for the new year ? Hello 'vry budy :- ) happy new year (when is the new year for you Fu ?) I saw you come back and comm ... (Jan.18,18:59)

This site is powered by Dao
Copyright (C) 2009,2010, daovm.net.
Webmaster: admin@daovm.net