qyli Posted February 19, 2011 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.
void Posted February 21, 2011 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
qyli Posted February 21, 2011 Author 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)
frustum Posted February 22, 2011 Posted February 22, 2011 What kind of functionality you want? May be there is an another solution of your task?
qyli Posted February 24, 2011 Author 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.
qyli Posted February 25, 2011 Author 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.
frustum Posted February 28, 2011 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 )), );
qyli Posted March 4, 2011 Author 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?
frustum Posted March 4, 2011 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
Recommended Posts