Jump to content

exporting a table via string


chromium

Recommended Posts

Hi,

 

I'm trying to export a serialized-to-string table from the mission scripting environment to the "hooks" scripting environment using this function, called in the hooks file:

 

	function get_tblDeadUnits()
	local tdu, tdu_err = net.dostring_in("mission", [[a_do_script("tblString = tblSerialized")]])
	if tdu_err then
		return tdu
	else
		return "errore"
	end	
end
local tString = get_tblDeadUnits()

 

the tblSerialized table exist correctly in the mission scritping env, but it's readed "" (not nil) in when the function work in the hooks environment.

 

Any suggestion?

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

The value should be only one, a string of text of the serialized table. What happens now is that it returns always "" if the function is called ok, or worse error.

 

I'm trying to think something different but at the moment no luck. I'll try your solution anyway. :)

 

thanks!

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

Didn't work but i found a very ugly but viable solution printing the table serialized into a trigger message, and then reading and loading it via 'ontriggermessage' callback.

 

That might be possibile for me only cause i need this export at mission end only.

 

Inviato dal mio SM-G920F utilizzando Tapatalk

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

Didn't work but i found a very ugly but viable solution printing the table serialized into a trigger message, and then reading and loading it via 'ontriggermessage' callback.

 

That might be possibile for me only cause i need this export at mission end only.

 

Inviato dal mio SM-G920F utilizzando Tapatalk

 

I'm also looking how to manage a table variable. What I would like to do it's print out table content in a .txt file each time a call that script/function, I'm thinking to use it each 120secs or something like that.

 

Any tips to do that?

FlighRIG => CPU: RyZen 5900x | RAM: 64GB Corsair 3000Mhz | GPU: nVIDIA RTX 4090 FE | OS Storage: SSD NVMe Samsung 850 Pro 512GB, DCS Storage: SSD NVMe Sabrent 1TB | Device: Multipurpose-UFC, VirPil T-50, TM WARTHOG Throttle, TrackHat, MFD Cougar with screen.

Our Servers => [ITA] Banshee | Krasnodar - PvE | PersianConquest PvE Live Map&Stats | Syria Liberation PvE Conquest

Support us on twitch subscribing with amazon prime account linked, it's free!

Link to comment
Share on other sites

I'm also looking how to manage a table variable. What I would like to do it's print out table content in a .txt file each time a call that script/function, I'm thinking to use it each 120secs or something like that.

 

Any tips to do that?

 

only way is to modify missionscripting.lua to allow io and lfs to work into the mission scripting environment (make a search). Then you can do almost everything.... but I didn't want to alter DCS core file.

 

If you need examples, look at DAWS free code here:

https://forums.eagle.ru/showpost.php?p=3662544&postcount=195

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

only way is to modify missionscripting.lua to allow io and lfs to work into the mission scripting environment (make a search). Then you can do almost everything.... but I didn't want to alter DCS core file.

 

If you need examples, look at DAWS free code here:

https://forums.eagle.ru/showpost.php?p=3662544&postcount=195

It's possible to create a function outside mission ( Scripts\MySpecialFunction.lua ) and call it inside mission environment to save data?

 

Like how is made with srs log, slmod etc.. ?

FlighRIG => CPU: RyZen 5900x | RAM: 64GB Corsair 3000Mhz | GPU: nVIDIA RTX 4090 FE | OS Storage: SSD NVMe Samsung 850 Pro 512GB, DCS Storage: SSD NVMe Sabrent 1TB | Device: Multipurpose-UFC, VirPil T-50, TM WARTHOG Throttle, TrackHat, MFD Cougar with screen.

Our Servers => [ITA] Banshee | Krasnodar - PvE | PersianConquest PvE Live Map&Stats | Syria Liberation PvE Conquest

Support us on twitch subscribing with amazon prime account linked, it's free!

Link to comment
Share on other sites

search for net.dostring_in function, usable via hooks code (better than the export environment). but it seems that you can't get out data from the mission scripting environment using that solution... for now.

 

PS

dato che sei di milano se mi scrivi poi via pm ci parliamo in lingua. nel caso, sappi che non sono un programmatore... solo un pazzo patito di mission editing da 8 anni che ha imparato qualcosa di lua: 90% ne sai più di me se sei dell'ambiente.

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...