qyli Posted February 19, 2011 Share Posted February 19, 2011 any one here use lua? the table in lua is very power and flexible, especial useful when dealing with data files. hope can see it in unigine script. Link to comment
void Posted February 21, 2011 Share Posted February 21, 2011 Just use Lua. It's not a problem to export Unigine functionality via one of existing(or write your own) Lua-C-bind libraries. We checked it - works well. 2 Link to comment
qyli Posted February 21, 2011 Author Share Posted February 21, 2011 Just use Lua. It's not a problem to export Unigine functionality via one of existing(or write your own) Lua-C-bind libraries. We checked it - works well. yes, that should work, but not so convenience especial considering interaction with user interface(as ungine has native script support to gui) Link to comment
frustum Posted February 22, 2011 Share Posted February 22, 2011 What kind of functionality you want? May be there is an another solution of your task? Link to comment
qyli Posted February 24, 2011 Author Share Posted February 24, 2011 What kind of functionality you want? May be there is an another solution of your task? i want use script to describe data directly, for example all item of a game can be described as follow in lua { [0] = { "name" = "test1", "damage" = 30, "on_attak" = function(xxx) end ... }, [1] = { "name" = "test2", "hp" = 30, "onused" = function(xxx) end ... }, } i think this way is very flexible. Link to comment
frustum Posted February 24, 2011 Share Posted February 24, 2011 Mmm, what about xml-based data Link to comment
qyli Posted February 25, 2011 Author Share Posted February 25, 2011 yes, xml can describe any data you want, but you need to parse it, personal i don't like xml, it's big and awkward. Link to comment
frustum Posted February 28, 2011 Share Posted February 28, 2011 There are two generic array wrappers Unigine::Vector and Unigine::Map. It's possible to use arrays inside the arrays: int data[] = ( new Unigine::Map(( "name" : "name 1", "health" : 20 )), new Unigine::Map(( "name" : "name 2", "health" : 40 )), ); Link to comment
qyli Posted March 4, 2011 Author Share Posted March 4, 2011 There are two generic array wrappers Unigine::Vector and Unigine::Map. It's possible to use arrays inside the arrays: int data[] = ( new Unigine::Map(( "name" : "name 1", "health" : 20 )), new Unigine::Map(( "name" : "name 2", "health" : 40 )), ); this doesn't work Unigine::Map m1 = new Unigine::Map(("name" : "name 1")); printf("%s", typeinfo(m1.find("name 1"))); will output int:-1 after view the source of <core/scripts/array.h> add construct function to Map Map(int d[]) { data = d; } will give correct result. so this is a bug? Link to comment
frustum Posted March 4, 2011 Share Posted March 4, 2011 I didn't check this sample... This is an updated array.h file. Which will be available in next SDK update. I have added constructors to Unigine::Map. There is no single argument constructor for Unigine::Vector which was specified the vector size. array.h Link to comment
Recommended Posts