2 #include "moviedata.hpp"
6 function_ptr_luafun
hm_read("hostmemory.read", [](lua_State
* LS
, const std::string
& fname
) -> int {
7 size_t address
= get_numeric_argument
<size_t>(LS
, 1, fname
.c_str());
8 auto& h
= get_host_memory();
9 if(address
>= h
.size()) {
10 lua_pushboolean(LS
, 0);
13 lua_pushnumber(LS
, static_cast<uint8_t>(h
[address
]));
17 function_ptr_luafun
hm_write("hostmemory.write", [](lua_State
* LS
, const std::string
& fname
) -> int {
18 size_t address
= get_numeric_argument
<size_t>(LS
, 1, fname
.c_str());
19 uint8_t value
= get_numeric_argument
<uint8_t>(LS
, 2, fname
.c_str());
20 auto& h
= get_host_memory();
21 if(address
>= h
.size())
22 h
.resize(address
+ 1);