我正在尝试在我的 premake5 脚本中添加一个新的 premake5 字段,但无法理解如何指定 field.kind 。
我想添加一个包含 (path, string) 对列表的字段,但不知道如何指定种类 spec 。文档和示例不是特别清楚。
这就是我注册新领域的方式
premake.api.register( {
name = "mypathmappings",
scope = "config",
kind = "list:path:string", or "list:keyed:path:string"
}
)
在配置范围内,我像这样声明字段项
project myproject
mypathmappings { ["path/to/file1"] = "stringvalue1", ["path/to/file2"] = "stringvalue2"}
但是,在处理时间方面,我没有得到我在该领域的期望:
function processpathmappings(cfg)
local pathmappings = cfg.mypathmappings
for path, value in pairs(pathmappings) do
--do something with the path and value but
--value is not a string as expected
end
end
有人可以解释如何从 api.lua 中注册的字段种类正确构建复杂种类吗?
我知道“list:integer”指定了一个整数列表,但不知道“keyed”元素是如何工作的。