How to add a new option?

Asked by Riug74 on 2011-08-12

I have created some progress bar packs and I want to make a function of choice a pack in the "Options" screen. But I cannot add my own option (called "ProgressBarType") to the list in "preferences.lua".

A fragment from "stratagus.lua":

if (preferences == nil) then
  preferences = {
    ...
    ProgressBarType = 0,
  }
end.
...
SetProgressBarType(preferences.ProgressBarType) // if I add this line to the code, Wargus crashes - this option doesn't exists.

Question information

Language:
English Edit question
Status:
Solved
For:
Wargus Edit question
Assignee:
Pali Edit question
Solved by:
Pali
Solved:
2011-08-14
Last query:
2011-08-14
Last reply:
2011-08-12
Best Pali (pali) said : #1

You need native C/C++ function SetProgressBarType in Stratagus and export it to Lua in Stratagus too. Or you can create Lua function and add it to some Wargus lua scripts.

Riug74 (riug-74) said : #2

Thanks Pali, that solved my question.

Where can I find theses native C/C++ functions?

Pali (pali) said : #4

SetProgressBarType does not exists.

All functions are in Stratagus source code (and exported in files src/stratagus/script.cpp and src/tolua/*.pkg)