portal64-still-alive/tools/level_scripts/yaml_loader.lua
Matt Penny fa0940fe90 Work on CMake conversion: test chambers
Incidental changes along the way:
* Move `export_level.lua` to `tools/level_scripts/`
* Small reorganizations/fixes to existing `CMakeLists.txt` files
* Support passing absolute paths to level export
2024-09-13 00:53:55 -04:00

19 lines
467 B
Lua

local util = require('tools.level_scripts.util')
local yaml = require('yaml')
local sk_input = require('sk_input')
local file_stem = sk_input.input_filename:match(".+[\\/]([^\\.]+)")
local file_location = util.path_join(
"assets",
"test_chambers",
file_stem,
file_stem .. ".yaml"
)
local input_file = io.open(file_location, 'r')
local json_contents = yaml.parse(input_file:read('a'))
input_file:close()
return {
json_contents = json_contents,
}