This commit is contained in:
IonutParau 2025-05-24 16:12:55 +02:00
parent 542b4340a8
commit 4e3410e05a
3 changed files with 13 additions and 6 deletions

View File

@ -1,6 +1,7 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "neonucleus.h"
#include "testLuaArch.h"
@ -8,9 +9,7 @@ void emulator_debugPrint(void *componentUserdata, void *methodUserdata, nn_compo
nn_value msg = nn_getArgument(computer, 0);
const char *m = nn_toCString(msg);
printf("[DEBUG] %s\n", m);
nn_return(computer, nn_values_cstring(m));
nn_return(computer, nn_values_cstring(m));
nn_return(computer, nn_values_cstring(m));
nn_return(computer, nn_values_integer(strlen(m)));
}
int main() {

View File

@ -1,7 +1,11 @@
print(component.doc("debugPrint", "log"))
local a, b, c = component.invoke("debugPrint", "log", "Absolute cinema")
print(a, b, c)
print(component.invoke("debugPrint", "log", "Absolute cinema"))
computer.pushSignal("stuff", 123, "b", false, nil)
computer.pushSignal("stuff", 123, "a", false, nil)
computer.pushSignal("stuf2", 456, "b", true, "shit")
computer.pushSignal("stuf3", 789, "c", false, -13)
print(computer.popSignal())
print(computer.popSignal())
print(computer.popSignal())
print(computer.popSignal())

View File

@ -355,6 +355,10 @@ void testLuaArch_loadEnv(lua_State *L) {
lua_setfield(L, computer, "getTemperature");
lua_pushcfunction(L, testLuaArch_computer_addHeat);
lua_setfield(L, computer, "addHeat");
lua_pushcfunction(L, testLuaArch_computer_pushSignal);
lua_setfield(L, computer, "pushSignal");
lua_pushcfunction(L, testLuaArch_computer_popSignal);
lua_setfield(L, computer, "popSignal");
lua_setglobal(L, "computer");
lua_createtable(L, 0, 10);