[C++] [Release] Lua C API - Printing a string 04-29-2018, 04:45 AM
#1
Download
VirusTotal
VirusTotal
Spoiler: Lua Interpreter.cpp
Code:
#pragma comment(lib, "lua5.1.lib")
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <Windows.h>
extern "C"
{
  #include "lua.h"
  #include "lauxlib.h"
  #include "lualib.h"
}
using namespace std;
int main(void)
{
  SetConsoleTitleA("Lua C API - Printing a string (Made by Confidential)");
  lua_State *L = luaL_newstate(); // Creates our environment
  luaL_openlibs(L); // Loads the libraries
  luaL_dofile(L, "Test.lua"); // Runs the Lua file
  lua_close(L); // Exits our environment
  system("pause");
  return 0;
}Spoiler: Test.lua
Code:
function infiniteLoop(time)
local second = tonumber(os.clock() + time)
while (os.clock() < second) do
print("This text was printed to the console using the Lua C API!")
end
end
infiniteLoop(5)
(This post was last modified: 02-04-2019, 02:22 AM by Confidential.)


![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)




























